diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/search/LuceneEntity.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/search/LuceneEntity.kt index 30180c04d..087bb88b7 100644 --- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/search/LuceneEntity.kt +++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/search/LuceneEntity.kt @@ -44,6 +44,7 @@ fun BookDto.toDocument() = fun SeriesDto.toDocument() = Document().apply { add(TextField("title", metadata.title, Field.Store.NO)) + if (metadata.titleSort != metadata.title) add(TextField("title", metadata.titleSort, Field.Store.NO)) add(TextField("publisher", metadata.publisher, Field.Store.NO)) add(TextField("status", metadata.status, Field.Store.NO)) add(TextField("reading_direction", metadata.readingDirection, Field.Store.NO)) diff --git a/komga/src/test/kotlin/org/gotson/komga/infrastructure/search/SearchIndexLifecycleTest.kt b/komga/src/test/kotlin/org/gotson/komga/infrastructure/search/SearchIndexLifecycleTest.kt index b59a9ceaa..b5dc9ea9e 100644 --- a/komga/src/test/kotlin/org/gotson/komga/infrastructure/search/SearchIndexLifecycleTest.kt +++ b/komga/src/test/kotlin/org/gotson/komga/infrastructure/search/SearchIndexLifecycleTest.kt @@ -175,7 +175,7 @@ class SearchIndexLifecycleTest( } seriesMetadataRepository.findById(series.id).let { - seriesMetadataRepository.update(it.copy(title = "updated")) + seriesMetadataRepository.update(it.copy(title = "updated", titleSort = "updated")) } mockEventPublisher.publishEvent(DomainEvent.SeriesUpdated(series)) @@ -279,7 +279,7 @@ class SearchIndexLifecycleTest( @Test fun `given an entity when updating then it is updated in the index`() { - val readList = org.gotson.komga.domain.model.ReadList("readlist") + val readList = ReadList("readlist") readListLifecycle.addReadList(readList) luceneHelper.searchEntitiesIds("readlist", LuceneEntity.ReadList).let { found -> @@ -304,7 +304,7 @@ class SearchIndexLifecycleTest( @Test fun `given an entity when deleting then it is removed from the index`() { - val readList = org.gotson.komga.domain.model.ReadList("readlist") + val readList = ReadList("readlist") readListLifecycle.addReadList(readList) luceneHelper.searchEntitiesIds("readlist", LuceneEntity.ReadList).let { found ->