Skip to content

Commit 83f9fcc

Browse files
authored
Update lucene version (JabRef#11719)
* Update lucene version * Change version
1 parent f5c7c18 commit 83f9fcc

File tree

4 files changed

+13
-5
lines changed

4 files changed

+13
-5
lines changed

src/main/java/module-info.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@
155155

156156
// region: Lucene
157157
/**
158-
* In case the version is updated, please also adapt {@link org.jabref.model.search.SearchFieldConstants#VERSION} to the newly used version.
158+
* In case the version is updated, please also increment {@link org.jabref.model.search.SearchFieldConstants#VERSION} to trigger reindexing.
159159
*/
160160
uses org.apache.lucene.codecs.lucene99.Lucene99Codec;
161161
requires org.apache.lucene.analysis.common;

src/main/java/org/jabref/gui/LibraryTab.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -858,7 +858,9 @@ private void onClosed(Event event) {
858858
LOGGER.error("Problem when closing directory monitor", e);
859859
}
860860
try {
861-
luceneManager.close();
861+
if (luceneManager != null) {
862+
luceneManager.close();
863+
}
862864
} catch (RuntimeException e) {
863865
LOGGER.error("Problem when closing lucene indexer", e);
864866
}

src/main/java/org/jabref/model/search/Analyzer/LatexAwareNGramAnalyzer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ protected TokenStreamComponents createComponents(String fieldName) {
2626
result = new StopFilter(result, EnglishAnalyzer.ENGLISH_STOP_WORDS_SET);
2727
result = new ASCIIFoldingFilter(result);
2828
result = new LowerCaseFilter(result);
29-
result = new EdgeNGramTokenFilter(result, minGram, maxGram, true);
29+
result = new EdgeNGramTokenFilter(result, minGram, maxGram, true);
3030
return new TokenStreamComponents(source, result);
3131
}
3232
}

src/main/java/org/jabref/model/search/SearchFieldConstants.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,14 @@
99
import org.apache.lucene.analysis.en.EnglishAnalyzer;
1010

1111
public enum SearchFieldConstants {
12-
13-
VERSION("99"),
12+
/**
13+
* Version number for the search index.
14+
* Increment when:
15+
* 1. Index changes require reindexing (e.g., new/removed/renamed fields, analyzer changes)
16+
* 2. Lucene codec changes (see module-info.java Lucene section)
17+
* Incrementing triggers reindexing.
18+
*/
19+
VERSION("1"),
1420
DEFAULT_FIELD("any"),
1521
ENTRY_ID("id"),
1622
ENTRY_TYPE("entrytype"),

0 commit comments

Comments
 (0)