~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.
Python academiaanthropicarxivbravedeep-researchencryptionhome-automationhomeserverlocallocal-deep-researchlocal-llmmistralollamaopenaipubmedresearchresearch-toolretrieval-augmented-generationsearxngself-hosted
test(library): finish has_indexed_documents test-hygiene switch (#7442)
Imaduddin Bhaisahebc007549a5f56
diff --git a/tests/research_library/services/test_rag_stats_index_scope.py b/tests/research_library/services/test_rag_stats_index_scope.pyindex 0b15a805d6..5f08275a05 100644--- a/tests/research_library/services/test_rag_stats_index_scope.py+++ b/tests/research_library/services/test_rag_stats_index_scope.py@@ -7,13 +7,11 @@ afterwards under model B get rows pointing at B's index. Counting those rows by``collection_id`` alone reports documents that the current index cannot search,and disagrees with the ``RAGIndex`` row's own aggregate for the same index.-``search_engine_library`` still gates directly on this result-(``get_rag_stats(...)["indexed_documents"] == 0`` skips a collection);-``search_engine_collection`` now uses the cheaper, index-scoped-``has_indexed_documents`` instead (see-``test_collection_search_query_count.py``) and never calls-``get_rag_stats``. So the count below decides whether a search runs at-all only for the library engine.+Both ``search_engine_library`` and ``search_engine_collection`` now gate on+the cheaper, index-scoped ``has_indexed_documents`` instead (see+``test_collection_search_query_count.py``) and no longer call+``get_rag_stats``, so the count below no longer decides whether a search+runs at all.Uses the real-components harness from ``test_multi_model_switch_revert.py``:network-free fake embeddings, one in-memory sqlite session shared by everydiff --git a/tests/web_search_engines/engines/test_local_search_coverage.py b/tests/web_search_engines/engines/test_local_search_coverage.pyindex fa8c99ce96..494a833614 100644--- a/tests/web_search_engines/engines/test_local_search_coverage.py+++ b/tests/web_search_engines/engines/test_local_search_coverage.py@@ -406,6 +406,13 @@ class TestPerCollectionErrors:page_content="good",metadata={"source_id": "99", "document_title": "Good"},)+ # Returned by the first collection's search() in the no-indexed-docs+ # case. It must never reach the output: if the eligibility gate+ # regresses, this result leaks in and the test fails.+ unindexed_doc = _make_doc(+ page_content="unindexed",+ metadata={"source_id": "98", "document_title": "Unindexed"},+ )engine = _make_engine(settings_snapshot={"_username": "u"})with (@@ -450,9 +457,10 @@ class TestPerCollectionErrors:def rag_enter(self_rag):inst = Mock()if rag_call[0] == 0 and first_no_docs:- inst.get_rag_stats.return_value = {"indexed_documents": 0}+ inst.has_indexed_documents.return_value = False+ inst.search.return_value = [_sr(unindexed_doc, 0.05)]else:- inst.get_rag_stats.return_value = {"indexed_documents": 1}+ inst.has_indexed_documents.return_value = Trueinst.search.return_value = [_sr(good_doc, 0.1)]rag_call[0] += 1return instdiff --git a/tests/web_search_engines/test_engine_success_path.py b/tests/web_search_engines/test_engine_success_path.pyindex 1178fda3a8..777de16fb0 100644--- a/tests/web_search_engines/test_engine_success_path.py+++ b/tests/web_search_engines/test_engine_success_path.py@@ -1553,12 +1553,11 @@ def _fake_rag_hit():def _fake_rag_service(module):"""Context-manager stub for ``LibraryRAGService``.- ``get_rag_stats`` is still load-bearing for ``_drive_library``- (``search_engine_library`` gates on it). It is dead configuration for- ``_drive_collection``: ``search_engine_collection`` gates on- ``has_indexed_documents`` instead, which this unconfigured MagicMock- attribute already answers truthily, so the stub is kept as-is rather- than split per engine.+ Both ``search_engine_library`` and ``search_engine_collection`` gate on+ ``has_indexed_documents``, which this unconfigured MagicMock attribute+ already answers truthily. ``get_rag_stats`` is therefore dead+ configuration for ``_drive_library`` and ``_drive_collection`` alike; the+ stub is kept as-is rather than split per engine."""service = MagicMock()service.get_rag_stats.return_value = {"indexed_documents": 5}