Skip to content

Commit

Permalink
Update lucene version (JabRef#11719)
Browse files Browse the repository at this point in the history
* Update lucene version

* Change version
  • Loading branch information
LoayGhreeb committed Sep 7, 2024
1 parent f5c7c18 commit 83f9fcc
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@

// region: Lucene
/**
* In case the version is updated, please also adapt {@link org.jabref.model.search.SearchFieldConstants#VERSION} to the newly used version.
* In case the version is updated, please also increment {@link org.jabref.model.search.SearchFieldConstants#VERSION} to trigger reindexing.
*/
uses org.apache.lucene.codecs.lucene99.Lucene99Codec;
requires org.apache.lucene.analysis.common;
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/org/jabref/gui/LibraryTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -858,7 +858,9 @@ private void onClosed(Event event) {
LOGGER.error("Problem when closing directory monitor", e);
}
try {
luceneManager.close();
if (luceneManager != null) {
luceneManager.close();
}
} catch (RuntimeException e) {
LOGGER.error("Problem when closing lucene indexer", e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ protected TokenStreamComponents createComponents(String fieldName) {
result = new StopFilter(result, EnglishAnalyzer.ENGLISH_STOP_WORDS_SET);
result = new ASCIIFoldingFilter(result);
result = new LowerCaseFilter(result);
result = new EdgeNGramTokenFilter(result, minGram, maxGram, true);
result = new EdgeNGramTokenFilter(result, minGram, maxGram, true);
return new TokenStreamComponents(source, result);
}
}
10 changes: 8 additions & 2 deletions src/main/java/org/jabref/model/search/SearchFieldConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,14 @@
import org.apache.lucene.analysis.en.EnglishAnalyzer;

public enum SearchFieldConstants {

VERSION("99"),
/**
* Version number for the search index.
* Increment when:
* 1. Index changes require reindexing (e.g., new/removed/renamed fields, analyzer changes)
* 2. Lucene codec changes (see module-info.java Lucene section)
* Incrementing triggers reindexing.
*/
VERSION("1"),
DEFAULT_FIELD("any"),
ENTRY_ID("id"),
ENTRY_TYPE("entrytype"),
Expand Down

0 comments on commit 83f9fcc

Please sign in to comment.