refactor(fts): address PR #488 review concerns
- Extract isPureTextRelevance() private static method to replace the 7-clause inline boolean in searchDocuments - Guard long→int cast in relevanceSortedPageFromSql to prevent silent overflow at page ≥43M (CWE-190) - resolvePersonName now uses the typed API client (createApiClient) instead of raw fetch, aligning with project conventions - Update DocumentServiceTest stubs to match new FTS path (findFtsPageRaw + findAllById instead of findAllMatchingIdsByFts) - Rewrite page.server.spec.ts person-name tests to mock via path-based API dispatch, matching the new api.GET call site Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1655,9 +1655,9 @@ class DocumentServiceTest {
|
||||
String snippetHeadline = "Hier ist der \u0001Brief\u0002 aus Berlin";
|
||||
List<Object[]> rows = Collections.singletonList(new Object[]{docId, "Dok", snippetHeadline, false, null, null, null});
|
||||
|
||||
List<Object[]> ftsRows2 = new java.util.ArrayList<>();
|
||||
ftsRows2.add(new Object[]{docId, 0.5d, 1L});
|
||||
when(documentRepository.findFtsPageRaw(anyString(), anyInt(), anyInt())).thenReturn(ftsRows2);
|
||||
List<Object[]> snippetFtsRows = new java.util.ArrayList<>();
|
||||
snippetFtsRows.add(new Object[]{docId, 0.5d, 1L});
|
||||
when(documentRepository.findFtsPageRaw(anyString(), anyInt(), anyInt())).thenReturn(snippetFtsRows);
|
||||
when(documentRepository.findAllById(any())).thenReturn(List.of(doc));
|
||||
when(documentRepository.findEnrichmentData(any(), eq("Brief"))).thenReturn(rows);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user