Skip to content

Commit

Permalink
Merge branch 'main' into fix-for-issue-10548
Browse files Browse the repository at this point in the history
  • Loading branch information
Boston54 authored Oct 23, 2024
2 parents d6682d8 + bd7219f commit 32a9bb8
Show file tree
Hide file tree
Showing 118 changed files with 3,917 additions and 1,634 deletions.
18 changes: 0 additions & 18 deletions .github/workflows/on-review-submitted.yml

This file was deleted.

5 changes: 1 addition & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv
### Added

- We added a "view as BibTeX" option before importing an entry from the citation relation tab. [#11826](https://github.com/JabRef/jabref/issues/11826)
- We added probable search hits instead of exact matches. Sorting by hit score can be done by the new score table column. [#11542](https://github.com/JabRef/jabref/pull/11542)
- We added support finding LaTeX-encoded special characters based on plain Unicode and vice versa. [#11542](https://github.com/JabRef/jabref/pull/11542)
- When a search hits a file, the file icon of that entry is changed accordingly. [#11542](https://github.com/JabRef/jabref/pull/11542)
- We added an AI-based chat for entries with linked PDF files. [#11430](https://github.com/JabRef/jabref/pull/11430)
Expand Down Expand Up @@ -42,8 +41,6 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv

### Changed

- The search syntax is changed to [Apache Lucene syntax](https://lucene.apache.org/core/9_11_1/queryparser/org/apache/lucene/queryparser/classic/package-summary.html#Overview) (also to be similar to the [online search syntax](https://docs.jabref.org/collect/import-using-online-bibliographic-database#search-syntax)). [#11542](https://github.com/JabRef/jabref/pull/11542/)
- When searching using a regular expression, one needs to enclose the search string in `/`. [#11542](https://github.com/JabRef/jabref/pull/11542/)
- A search in "any" fields ignores the [groups](https://docs.jabref.org/finding-sorting-and-cleaning-entries/groups). [#7996](https://github.com/JabRef/jabref/issues/7996)
- When a communication error with an [online service](https://docs.jabref.org/collect/import-using-online-bibliographic-database) occurs, JabRef displays the HTTP error. [#11223](https://github.com/JabRef/jabref/issues/11223)
- The Pubmed/Medline Plain importer now imports the PMID field as well [#11488](https://github.com/JabRef/jabref/issues/11488)
Expand Down Expand Up @@ -98,12 +95,12 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv
- We fixed an issue where recently opened files were not displayed in the main menu properly. [#9042](https://github.com/JabRef/jabref/issues/9042)
- We fixed an issue where the DOI lookup would show an error when a DOI was found for an entry. [#11850](https://github.com/JabRef/jabref/issues/11850)
- We fixed an issue where <kbd>Tab</kbd> cannot be used to jump to next field in some single-line fields. [#11785](https://github.com/JabRef/jabref/issues/11785)
- We fixed an issue where it was not possible to select selecting content of other user's comments.[#11106](https://github.com/JabRef/jabref/issues/11106)
- We fixed an issue where web search preferences "Custom API key" table modifications not discarded. [#11925](https://github.com/JabRef/jabref/issues/11925)
- We fixed an issue where trying to open a library from a failed mounted directory on Mac would cause an error. [#10548](https://github.com/JabRef/jabref/issues/10548)

### Removed

- We removed support for case-sensitive and exact search. [#11542](https://github.com/JabRef/jabref/pull/11542)
- We removed the description of search strings. [#11542](https://github.com/JabRef/jabref/pull/11542)
- We removed support for importing using the SilverPlatterImporter (`Record INSPEC`). [#11576](https://github.com/JabRef/jabref/pull/11576)
- We removed support for automatically generating file links using the CLI (`--automaticallySetFileLinks`).
Expand Down
18 changes: 13 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ plugins {

id 'idea'

id 'org.openrewrite.rewrite' version '6.23.4'
id 'org.openrewrite.rewrite' version '6.25.1'

id "org.itsallcode.openfasttrace" version "3.0.0"
id "org.itsallcode.openfasttrace" version "3.0.1"
}

// Enable following for debugging
Expand Down Expand Up @@ -238,7 +238,7 @@ dependencies {
}
implementation 'org.fxmisc.flowless:flowless:0.7.3'
implementation 'org.fxmisc.richtext:richtextfx:0.11.3'
implementation (group: 'com.dlsc.gemsfx', name: 'gemsfx', version: '2.58.0') {
implementation (group: 'com.dlsc.gemsfx', name: 'gemsfx', version: '2.60.0') {
exclude module: 'javax.inject' // Split package, use only jakarta.inject
exclude module: 'commons-lang3'
exclude group: 'org.apache.commons.validator'
Expand Down Expand Up @@ -304,7 +304,7 @@ dependencies {
// Implementation of the API
implementation 'org.glassfish.jersey.core:jersey-server:3.1.9'
// injection framework
implementation 'org.glassfish.jersey.inject:jersey-hk2:3.1.8'
implementation 'org.glassfish.jersey.inject:jersey-hk2:3.1.9'
implementation 'org.glassfish.hk2:hk2-api:3.1.1'
// testImplementation 'org.glassfish.hk2:hk2-testing:3.0.4'
// implementation 'org.glassfish.hk2:hk2-testing-jersey:3.0.4'
Expand Down Expand Up @@ -370,11 +370,14 @@ dependencies {
// Even if "compileOnly" is used, IntelliJ always adds to module-info.java. To avoid issues during committing, we use "implementation" instead of "compileOnly"
implementation 'io.github.adr:e-adr:2.0.0-SNAPSHOT'

implementation 'io.zonky.test:embedded-postgres:2.0.7'
implementation enforcedPlatform('io.zonky.test.postgres:embedded-postgres-binaries-bom:17.0.0')

testImplementation 'io.github.classgraph:classgraph:4.8.177'
testImplementation 'org.junit.jupiter:junit-jupiter:5.11.0'
testImplementation 'org.junit.platform:junit-platform-launcher:1.10.3'

testImplementation 'org.mockito:mockito-core:5.14.1'
testImplementation 'org.mockito:mockito-core:5.14.2'
testImplementation 'org.xmlunit:xmlunit-core:2.10.0'
testImplementation 'org.xmlunit:xmlunit-matchers:2.10.0'
testRuntimeOnly 'com.tngtech.archunit:archunit-junit5-engine:1.3.0'
Expand Down Expand Up @@ -795,9 +798,13 @@ jlink {
requires 'org.apache.commons.lang3'
requires 'org.apache.commons.logging'
requires 'org.apache.commons.text'
requires 'org.apache.commons.codec'
requires 'org.apache.commons.io'
requires 'org.apache.commons.compress'
requires 'org.freedesktop.dbus'
requires 'org.jsoup'
requires 'org.slf4j'
requires 'org.tukaani.xz';
uses 'ai.djl.engine.EngineProvider'
uses 'ai.djl.repository.RepositoryFactory'
uses 'ai.djl.repository.zoo.ZooProvider'
Expand All @@ -809,6 +816,7 @@ jlink {
uses 'org.mariadb.jdbc.authentication.AuthenticationPlugin'
uses 'org.mariadb.jdbc.credential.CredentialPlugin'
uses 'org.mariadb.jdbc.tls.TlsSocketPlugin'
uses 'org.postgresql.shaded.com.ongres.stringprep.Profile'

provides 'org.mariadb.jdbc.tls.TlsSocketPlugin' with 'org.mariadb.jdbc.internal.protocol.tls.DefaultTlsSocketPlugin'
provides 'java.sql.Driver' with 'org.postgresql.Driver'
Expand Down
18 changes: 14 additions & 4 deletions external-libraries.md
Original file line number Diff line number Diff line change
Expand Up @@ -357,10 +357,10 @@ License: MIT
```
```yaml
Id:io.github.adr:e-adr
Project:EmbeddedArchitecturalDecisionRecords
URL:https://github.com/adr/e-adr/
License:EPL-2.0
Id: io.github.adr:e-adr
Project: EmbeddedArchitecturalDecisionRecords
URL: https://github.com/adr/e-adr/
License: EPL-2.0
```
```yaml
Expand All @@ -370,6 +370,13 @@ URL: https://github.com/java-diff-utils/java-diff-utils
License: Apache-2.0
```
```yaml
Id: io.zonky.test:embedded-postgres
Project: embedded-postgres
URL: https://github.com/zonkyio/embedded-postgres
License: Apache-2.0
```
```yaml
Id: jakarta.annotation:jakarata.annotation-api
Project: Jakarta Annotations
Expand Down Expand Up @@ -806,6 +813,7 @@ de.undercouch:citeproc-java:3.1.0
eu.lestard:doc-annotations:0.2
info.debatty:java-string-similarity:2.0.0
io.github.java-diff-utils:java-diff-utils:4.12
io.zonky.test:embedded-postgres:2.0.7
jakarta.activation:jakarta.activation-api:2.1.3
jakarta.annotation:jakarta.annotation-api:2.1.1
jakarta.inject:jakarta.inject-api:2.0.1
Expand All @@ -821,6 +829,7 @@ net.jodah:typetools:0.6.1
net.synedra:validatorfx:0.5.0
one.jpro.jproutils:tree-showing:0.2.2
org.antlr:antlr4-runtime:4.13.2
org.apache.commons:commons-compress:1.27.1
org.apache.commons:commons-csv:1.11.0
org.apache.commons:commons-lang3:3.17.0
org.apache.commons:commons-text:1.12.0
Expand Down Expand Up @@ -897,6 +906,7 @@ org.slf4j:slf4j-api:2.0.16
org.tinylog:slf4j-tinylog:2.7.0
org.tinylog:tinylog-api:2.7.0
org.tinylog:tinylog-impl:2.7.0
org.tukaani:xz:1.9
org.yaml:snakeyaml:2.3
pt.davidafsilva.apple:jkeychain:1.1.0
tech.units:indriya:2.2
Expand Down
97 changes: 65 additions & 32 deletions src/main/antlr4/org/jabref/search/Search.g4
Original file line number Diff line number Diff line change
Expand Up @@ -4,49 +4,82 @@
* These search expressions are used for searching the bibtex library. They are heavily used for search groups.
*/
grammar Search;
options { caseInsensitive = true; }

WS: [ \t] -> skip; // whitespace is ignored/skipped
WS: [ \t\n\r]+ -> skip; // whitespace is ignored/skipped

LPAREN:'(';
RPAREN:')';
LPAREN: '(';
RPAREN: ')';

EQUAL:'='; // semantically the same as CONTAINS
EEQUAL:'=='; // semantically the same as MATCHES
NEQUAL:'!=';
EQUAL: '='; // case insensitive contains, semantically the same as CONTAINS
CEQUAL: '=!'; // case sensitive contains

AND:[aA][nN][dD]; // 'and' case insensitive
OR:[oO][rR]; // 'or' case insensitive
CONTAINS:[cC][oO][nN][tT][aA][iI][nN][sS]; // 'contains' case insensitive
MATCHES:[mM][aA][tT][cC][hH][eE][sS]; // 'matches' case insensitive
NOT:[nN][oO][tT]; // 'not' case insensitive
EEQUAL: '=='; // exact match case insensitive, semantically the same as MATCHES
CEEQUAL: '==!'; // exact match case sensitive

STRING:QUOTE (~'"')* QUOTE;
QUOTE:'"';
REQUAL: '=~'; // regex check case insensitive
CREEQUAL: '=~!'; // regex check case sensitive

FIELDTYPE:LETTER+;
// fragments are not accessible from the code, they are only for describing the grammar better
fragment LETTER : ~[ \t"()=!];
NEQUAL: '!='; // negated case insensitive contains
NCEQUAL: '!=!'; // negated case sensitive contains

NEEQUAL: '!=='; // negated case insensitive exact match
NCEEQUAL: '!==!'; // negated case sensitive exact match

start:
expression EOF;
NREQUAL: '!=~'; // negated regex check case insensitive
NCREEQUAL: '!=~!'; // negated regex check case sensitive

// labels are used to refer to parts of the rules in the generated code later on
// label=actualThingy
expression:
LPAREN expression RPAREN #parenExpression // example: (author=miller)
| NOT expression #unaryExpression // example: not author = miller
| left=expression operator=AND right=expression #binaryExpression // example: author = miller and title = test
| left=expression operator=OR right=expression #binaryExpression // example: author = miller or title = test
| comparison #atomExpression
AND: 'AND';
OR: 'OR';
CONTAINS: 'CONTAINS';
MATCHES: 'MATCHES';
NOT: 'NOT';

FIELD: [A-Z]+;
STRING_LITERAL: '"' ('\\"' | ~["])* '"'; // " should be escaped with a backslash
TERM: ('\\' [=!~()] | ~[ \t\n\r=!~()])+; // =!~() should be escaped with a backslash
start
: EOF
| andExpression EOF
;
andExpression
: expression+ #implicitAndExpression // example: author = miller year = 2010 --> equivalent to: author = miller AND year = 2010
;
expression
: LPAREN andExpression RPAREN #parenExpression // example: (author = miller)
| NOT expression #negatedExpression // example: NOT author = miller
| left = expression bin_op = AND right = expression #binaryExpression // example: author = miller AND year = 2010
| left = expression bin_op = OR right = expression #binaryExpression // example: author = miller OR year = 2010
| comparison #comparisonExpression // example: miller OR author = miller
;
comparison
: FIELD operator searchValue // example: author = miller
| searchValue // example: miller
;
comparison:
left=name operator=(CONTAINS | MATCHES | EQUAL | EEQUAL | NEQUAL) right=name // example: author != miller
| right=name // example: miller (search all fields)
operator
: EQUAL
| CEQUAL
| EEQUAL
| CEEQUAL
| REQUAL
| CREEQUAL
| NEQUAL
| NCEQUAL
| NEEQUAL
| NCEEQUAL
| NREQUAL
| NCREEQUAL
| CONTAINS
| MATCHES
;
name:
STRING // example: "miller"
| FIELDTYPE // example: author
searchValue
: STRING_LITERAL
| FIELD
| TERM
;
7 changes: 5 additions & 2 deletions src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@
// endregion

// region: SQL databases
requires embedded.postgres;
requires org.tukaani.xz;
requires ojdbc10;
requires org.postgresql.jdbc;
requires org.mariadb.jdbc;
Expand All @@ -108,6 +110,7 @@
requires io.github.javadiffutils;
requires java.string.similarity;
requires org.apache.commons.cli;
requires org.apache.commons.compress;
requires org.apache.commons.csv;
requires org.apache.commons.io;
requires org.apache.commons.lang3;
Expand Down Expand Up @@ -160,8 +163,8 @@
// endregion

// region: Lucene
/**
* In case the version is updated, please also increment {@link org.jabref.model.search.SearchFieldConstants#VERSION} to trigger reindexing.
/*
* In case the version is updated, please also increment {@link org.jabref.model.search.LinkedFilesConstants.VERSION} to trigger reindexing.
*/
uses org.apache.lucene.codecs.lucene100.Lucene100Codec;
requires org.apache.lucene.analysis.common;
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/org/jabref/Launcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import org.jabref.gui.util.DefaultFileUpdateMonitor;
import org.jabref.logic.UiCommand;
import org.jabref.logic.preferences.CliPreferences;
import org.jabref.logic.search.PostgreServer;
import org.jabref.logic.util.HeadlessExecutorService;
import org.jabref.migrations.PreferencesMigrations;

Expand Down Expand Up @@ -38,6 +39,9 @@ public static void main(String[] args) {

PreferencesMigrations.runMigrations(preferences);

PostgreServer postgreServer = new PostgreServer();
Injector.setModelOrService(PostgreServer.class, postgreServer);

JabRefGUI.setup(uiCommands, preferences, fileUpdateMonitor);
JabRefGUI.launch(JabRefGUI.class, args);
}
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/jabref/cli/ArgumentProcessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
import org.jabref.model.database.BibDatabaseMode;
import org.jabref.model.entry.BibEntry;
import org.jabref.model.entry.BibEntryTypesManager;
import org.jabref.model.search.SearchQuery;
import org.jabref.model.search.query.SearchQuery;
import org.jabref.model.strings.StringUtil;
import org.jabref.model.util.DummyFileUpdateMonitor;
import org.jabref.model.util.FileUpdateMonitor;
Expand Down Expand Up @@ -458,8 +458,8 @@ private boolean exportMatches(List<ParserResult> loaded) {

List<BibEntry> matches;
try {
// extract current thread task executor from luceneManager
matches = new DatabaseSearcher(query, databaseContext, new CurrentThreadTaskExecutor(), cliPreferences.getFilePreferences()).getMatches();
// extract current thread task executor from indexManager
matches = new DatabaseSearcher(query, databaseContext, new CurrentThreadTaskExecutor(), cliPreferences).getMatches();
} catch (IOException e) {
LOGGER.error("Error occurred when searching", e);
return false;
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/org/jabref/gui/JabRefGUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import org.jabref.logic.net.ProxyRegisterer;
import org.jabref.logic.remote.RemotePreferences;
import org.jabref.logic.remote.server.RemoteListenerServerManager;
import org.jabref.logic.search.PostgreServer;
import org.jabref.logic.util.BuildInfo;
import org.jabref.logic.util.FallbackExceptionHandler;
import org.jabref.logic.util.HeadlessExecutorService;
Expand Down Expand Up @@ -395,6 +396,9 @@ public static void shutdownThreadPools() {
LOGGER.trace("Shutting down directoryMonitor");
DirectoryMonitor directoryMonitor = Injector.instantiateModelOrService(DirectoryMonitor.class);
directoryMonitor.shutdown();
LOGGER.trace("Shutting down postgreServer");
PostgreServer postgreServer = Injector.instantiateModelOrService(PostgreServer.class);
postgreServer.shutdown();
LOGGER.trace("Shutting down HeadlessExecutorService");
HeadlessExecutorService.INSTANCE.shutdownEverything();
LOGGER.trace("Finished shutdownThreadPools");
Expand Down
Loading

0 comments on commit 32a9bb8

Please sign in to comment.