Skip to content

Commit

Permalink
fix: do not share IndexWriterConfig instances across IndexWriters
Browse files Browse the repository at this point in the history
Closes: #1603
  • Loading branch information
gotson committed Jul 25, 2024
1 parent 16e8b97 commit 90db07c
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,11 @@ class LuceneHelper(
private val directory: Directory,
private val searchAnalyzer: Analyzer,
private val taskScheduler: TaskScheduler,
indexAnalyzer: Analyzer,
private val indexAnalyzer: Analyzer,
@Value("#{@komgaProperties.lucene.commitDelay}")
private val commitDelay: Duration,
) {
private val indexWriterConfig = IndexWriterConfig(indexAnalyzer)
private val indexWriter: IndexWriter = IndexWriter(directory, indexWriterConfig)
private val indexWriter: IndexWriter = IndexWriter(directory, IndexWriterConfig(indexAnalyzer))
private val searcherManager = SearcherManager(indexWriter, SearcherFactory())

fun indexExists(): Boolean = DirectoryReader.indexExists(directory)
Expand Down Expand Up @@ -95,7 +94,7 @@ class LuceneHelper(
}

fun upgradeIndex() {
IndexUpgrader(directory, indexWriterConfig, true).upgrade()
IndexUpgrader(directory, IndexWriterConfig(indexAnalyzer), true).upgrade()
logger.info { "Lucene index upgraded" }
}

Expand Down

0 comments on commit 90db07c

Please sign in to comment.