feat(search): upgrade to PostgreSQL full-text search with German stemming #237

Merged
marcel merged 8 commits from feat/issue-222-fts-search into main 2026-04-15 12:40:21 +02:00
Showing only changes of commit 43595aeb8a - Show all commits

View File

@@ -323,12 +323,11 @@ public class DocumentService {
boolean useRankOrder = hasText && (sort == null || sort == DocumentSort.RELEVANCE);
if (useRankOrder) {
List<Document> results = documentRepository.findAll(spec);
final List<UUID> ids = rankedIds;
Map<UUID, Integer> rankMap = new HashMap<>();
for (int i = 0; i < rankedIds.size(); i++) rankMap.put(rankedIds.get(i), i);
return results.stream()
.sorted(Comparator.comparingInt(doc -> {
int idx = ids.indexOf(doc.getId());
return idx < 0 ? Integer.MAX_VALUE : idx;
}))
.sorted(Comparator.comparingInt(
doc -> rankMap.getOrDefault(doc.getId(), Integer.MAX_VALUE)))
.toList();
}