mirror of
https://github.com/gotson/komga.git
synced 2026-04-29 02:14:07 +02:00
feat(api): add sharing_label criteria to full text search for series
Closes: #1146
This commit is contained in:
parent
737bf1b120
commit
040556e66a
3 changed files with 12 additions and 3 deletions
|
|
@ -63,6 +63,9 @@ fun SeriesDto.toDocument() =
|
|||
metadata.genres.forEach {
|
||||
add(TextField("genre", it, Field.Store.NO))
|
||||
}
|
||||
metadata.sharingLabels.forEach {
|
||||
add(TextField("sharing_label", it, Field.Store.NO))
|
||||
}
|
||||
if (metadata.totalBookCount != null) add(TextField("total_book_count", metadata.totalBookCount.toString(), Field.Store.NO))
|
||||
add(TextField("book_count", booksCount.toString(), Field.Store.NO))
|
||||
booksMetadata.authors.forEach {
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ import kotlin.math.ceil
|
|||
import kotlin.time.measureTime
|
||||
|
||||
private val logger = KotlinLogging.logger {}
|
||||
private const val INDEX_VERSION = 6
|
||||
private const val INDEX_VERSION = 7
|
||||
|
||||
@Component
|
||||
class SearchIndexLifecycle(
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package org.gotson.komga.interfaces.scheduler
|
|||
import mu.KotlinLogging
|
||||
import org.gotson.komga.application.tasks.HIGHEST_PRIORITY
|
||||
import org.gotson.komga.application.tasks.TaskEmitter
|
||||
import org.gotson.komga.infrastructure.search.LuceneEntity
|
||||
import org.gotson.komga.infrastructure.search.LuceneHelper
|
||||
import org.springframework.boot.context.event.ApplicationReadyEvent
|
||||
import org.springframework.context.annotation.Profile
|
||||
|
|
@ -24,9 +25,14 @@ class SearchIndexController(
|
|||
logger.info { "Lucene index not found, trigger rebuild" }
|
||||
taskEmitter.rebuildIndex(HIGHEST_PRIORITY)
|
||||
} else {
|
||||
logger.info { "Lucene index version: ${luceneHelper.getIndexVersion()}" }
|
||||
val indexVersion = luceneHelper.getIndexVersion()
|
||||
logger.info { "Lucene index version: $indexVersion" }
|
||||
when {
|
||||
luceneHelper.getIndexVersion() < 6 -> taskEmitter.upgradeIndex(HIGHEST_PRIORITY) // upgrade index to Lucene 9.x
|
||||
indexVersion < 6 -> {
|
||||
taskEmitter.upgradeIndex(HIGHEST_PRIORITY) // upgrade index to Lucene 9.x
|
||||
taskEmitter.rebuildIndex(HIGHEST_PRIORITY, setOf(LuceneEntity.Series))
|
||||
}
|
||||
indexVersion < 7 -> taskEmitter.rebuildIndex(HIGHEST_PRIORITY, setOf(LuceneEntity.Series))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue