fix: upgrade lucene version

will trigger a full rebuild of the index
This commit is contained in:
Gauthier Roebroeck 2021-12-22 16:45:48 +08:00
parent ec0acbc5cc
commit 4ee30dde96
4 changed files with 5 additions and 5 deletions

View file

@ -61,7 +61,7 @@ dependencies {
implementation("commons-validator:commons-validator:1.7") implementation("commons-validator:commons-validator:1.7")
run { run {
val luceneVersion = "8.9.0" val luceneVersion = "8.11.1" // 9.0.0 requires Java 11
implementation("org.apache.lucene:lucene-core:$luceneVersion") implementation("org.apache.lucene:lucene-core:$luceneVersion")
implementation("org.apache.lucene:lucene-analyzers-common:$luceneVersion") implementation("org.apache.lucene:lucene-analyzers-common:$luceneVersion")
implementation("org.apache.lucene:lucene-queryparser:$luceneVersion") implementation("org.apache.lucene:lucene-queryparser:$luceneVersion")

View file

@ -18,12 +18,12 @@ class LuceneConfiguration(
@Bean @Bean
fun indexAnalyzer() = fun indexAnalyzer() =
with(komgaProperties.lucene.indexAnalyzer) { with(komgaProperties.lucene.indexAnalyzer) {
MultiLingualNGramAnalyzer(minGram, maxGram, preserveOriginal).apply { version = Version.LUCENE_8_9_0 } MultiLingualNGramAnalyzer(minGram, maxGram, preserveOriginal).apply { version = Version.LUCENE_8_11_1 }
} }
@Bean @Bean
fun searchAnalyzer() = fun searchAnalyzer() =
MultiLingualAnalyzer().apply { version = Version.LUCENE_8_9_0 } MultiLingualAnalyzer().apply { version = Version.LUCENE_8_11_1 }
@Bean @Bean
@Profile("test") @Profile("test")

View file

@ -26,7 +26,7 @@ import kotlin.math.ceil
import kotlin.time.measureTime import kotlin.time.measureTime
private val logger = KotlinLogging.logger {} private val logger = KotlinLogging.logger {}
private const val INDEX_VERSION = 2 private const val INDEX_VERSION = 3
@Component @Component
class SearchIndexLifecycle( class SearchIndexLifecycle(

View file

@ -26,7 +26,7 @@ class SearchIndexController(
} else { } else {
logger.info { "Lucene index version: ${luceneHelper.getIndexVersion()}" } logger.info { "Lucene index version: ${luceneHelper.getIndexVersion()}" }
when (luceneHelper.getIndexVersion()) { when (luceneHelper.getIndexVersion()) {
1 -> taskReceiver.rebuildIndex(HIGHEST_PRIORITY) 1, 2 -> taskReceiver.rebuildIndex(HIGHEST_PRIORITY)
} }
} }
} }