Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update lucene version #11719

Merged
merged 2 commits into from
Sep 7, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.0"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think, just number is OK.

Alternative: 6.0.0 - to mirror the JabRef main version and the last number is the index version within a role. However since new JabRef versions come out and need no full rebuild, just 1 is good.

DEFAULT_FIELD("any"),
ENTRY_ID("id"),
ENTRY_TYPE("entrytype"),
Expand Down