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.

feat(library): warn in research log when collection search results are incomplete (#4520)

LearningCircuit6a53b462058b
diff --git a/changelog.d/4520.feature.md b/changelog.d/4520.feature.md
new file mode 100644
index 0000000000..86e8761b50
--- /dev/null
+++ b/changelog.d/4520.feature.md
@@ -0,0 +1 @@
+Library searches now warn in the research log when results are incomplete because one or more collections failed, naming the affected collections; failed-collection error messages use collection names instead of internal ids.
diff --git a/src/local_deep_research/web_search_engines/engines/search_engine_library.py b/src/local_deep_research/web_search_engines/engines/search_engine_library.py
index fb4455e477..3c3fafce6d 100644
--- a/src/local_deep_research/web_search_engines/engines/search_engine_library.py
+++ b/src/local_deep_research/web_search_engines/engines/search_engine_library.py
@@ -198,7 +198,9 @@ class LibraryRAGSearchEngine(BaseSearchEngine):
logger.exception(
f"Error searching collection {collection_id}"
)
- failed_collections.append(collection_id)
+ failed_collections.append(
+ collection.get("name") or str(collection_id)
+ )
continue
# Sort all results by score (lower is better for distance)
@@ -215,6 +217,17 @@ class LibraryRAGSearchEngine(BaseSearchEngine):
logger.info("No results found across any collections")
return []
+ if failed_collections:
+ # Partial success: results from the healthy collections are
+ # returned, but tell the user they are incomplete. WARNING
+ # level streams to the research-log UI via
+ # frontend_progress_sink.
+ logger.warning(
+ f"Library search results are incomplete: "
+ f"{len(failed_collections)} of {len(collections)} "
+ f"collection(s) failed: {failed_collections}"
+ )
+
# Convert Document objects to search results format
results = []
for doc, score in docs_with_scores:
diff --git a/tests/web_search_engines/engines/test_search_engine_library_coverage.py b/tests/web_search_engines/engines/test_search_engine_library_coverage.py
index 5e57e6d2bb..c550b067ca 100644
--- a/tests/web_search_engines/engines/test_search_engine_library_coverage.py
+++ b/tests/web_search_engines/engines/test_search_engine_library_coverage.py
@@ -111,9 +111,9 @@ class TestSearch:
with pytest.raises(RuntimeError, match="failed for 1"):
engine.search("test query")
- def test_search_collection_exception_continues(self):
- """Exception in one collection doesn't stop search of others."""
- engine = _make_engine()
+ @staticmethod
+ def _run_partial_failure_search(engine):
+ """Search two collections where col1 errors and col2 returns a hit."""
mock_service = MagicMock()
mock_service.get_all_collections.return_value = [
{"id": "col1", "name": "Collection 1"},
@@ -161,9 +161,28 @@ class TestSearch:
):
result = engine.search("test query")
+ return result
+
+ def test_search_collection_exception_continues(self):
+ """Exception in one collection doesn't stop search of others."""
+ engine = _make_engine()
+
+ result = self._run_partial_failure_search(engine)
+
assert len(result) == 1
assert result[0]["metadata"]["collection_name"] == "Collection 2"
+ def test_partial_failure_warns_results_incomplete(self, loguru_caplog):
+ """Partial success warns the user (research log) by collection name."""
+ engine = _make_engine()
+
+ with loguru_caplog.at_level("WARNING"):
+ result = self._run_partial_failure_search(engine)
+
+ assert len(result) == 1
+ assert "1 of 2 collection(s) failed" in loguru_caplog.text
+ assert "Collection 1" in loguru_caplog.text
+
def test_search_no_results_across_collections(self):
"""When all collections have no indexed docs, returns empty."""
engine = _make_engine()