Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

test(search): cover cross-collection dedup tiebreak (#5557)

Ziyang Guo8a0fede61ba0
diff --git a/tests/web/routes/test_unified_search_routes.py b/tests/web/routes/test_unified_search_routes.py
index 865fa487de..7b6e2c5828 100644
--- a/tests/web/routes/test_unified_search_routes.py
+++ b/tests/web/routes/test_unified_search_routes.py
@@ -543,6 +543,42 @@ class TestSemanticSearch:
0.9,
]
+ def test_dedup_keeps_full_precision_best_hit_across_collections(self):
+ collections = [
+ ("lib-1", "Library", "default_library"),
+ ("notes-1", "Notes", "notes"),
+ ]
+ lower_score = {
+ "relevance_score": 0.90041,
+ "title": "Lower-scoring duplicate",
+ "snippet": "first collection",
+ "metadata": {"document_id": "shared"},
+ }
+ higher_score = {
+ "relevance_score": 0.90049,
+ "title": "Higher-scoring duplicate",
+ "snippet": "second collection",
+ "metadata": {"document_id": "shared"},
+ }
+
+ (payload, status), _, _ = self._call(
+ collections=collections,
+ engine_side_effect=[[lower_score], [higher_score]],
+ doc_rows=[("shared", "note", None)],
+ )
+
+ assert status == 200
+ assert payload["results"] == [
+ {
+ "id": "shared",
+ "title": "Higher-scoring duplicate",
+ "content_preview": "second collection",
+ "similarity": 0.9,
+ "source_type": "note",
+ "url": "/notes/shared",
+ }
+ ]
+
def test_faiss_orphan_hits_are_dropped(self):
# A hit whose Document row is gone (deleted doc, lingering
# vectors) must not surface as a dead link.