~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
fix(searxng): honor search.snippets_only setting in get_search (#5901)
S2f6917076ae8
diff --git a/changelog.d/5887.bugfix.md b/changelog.d/5887.bugfix.mdnew file mode 100644index 0000000000..d61d0df9cb--- /dev/null+++ b/changelog.d/5887.bugfix.md@@ -0,0 +1 @@+Fixed SearXNG ignoring the `search.snippets_only=False` setting in `get_search()`, allowing it to wrap with `FullSearchResults` and return full webpage content when snippets-only mode is disabled.diff --git a/docs/CONFIGURATION.md b/docs/CONFIGURATION.mdindex b2116b7c78..6df1f78350 100644--- a/docs/CONFIGURATION.md+++ b/docs/CONFIGURATION.md@@ -595,7 +595,7 @@ They are not available in the Web UI because they are needed to start the applic| `search.engine.web.zenodo.strengths` | `LDR_SEARCH_ENGINE_WEB_ZENODO_STRENGTHS` | ``["research data", "datasets", "DOIs", "software", "open access", "CERN"]`` | Key strengths of Zenodo. | SEARCH || `search.engine.web.zenodo.weaknesses` | `LDR_SEARCH_ENGINE_WEB_ZENODO_WEAKNESSES` | ``["research focus", "variable quality", "metadata only"]`` | Limitations of Zenodo. | SEARCH || `search.favorites` | `LDR_SEARCH_FAVORITES` | ``["arxiv", "searxng", "library", "openalex"]`` | List of favorite search engine IDs that appear at the top of the dropdown. Edit as JSON array, e.g. ["arxiv", "brave"] | SEARCH |-| `search.fetch.mode` | `LDR_SEARCH_FETCH_MODE` | `summary_focus_query` | Controls the LangGraph agent's fetch_content tool. 'summary_focus_query' (default) asks the LLM to extract only spans relevant to a focus question the agent supplies per call AND the original research query, so vague focus can be disambiguated — keeps small-model context clean. 'summary_focus' is the same but uses only the per-call focus question. 'full' returns the entire extracted page text (legacy behavior; can flood small-model context with boilerplate/metadata and degrade benchmark accuracy). 'disabled' removes the tool entirely so the agent works from search snippets only — useful for diagnosing whether fetching is helping or hurting accuracy. | SEARCH |+| `search.fetch.mode` | `LDR_SEARCH_FETCH_MODE` | `summary_focus_query` | Controls the LangGraph agent's fetch_content tool. 'summary_focus_query' (default) asks the LLM to extract only spans relevant to a focus question the agent supplies per call AND the original research query, so vague focus can be disambiguated — keeps small-model context clean. 'summary_focus' is the same but uses only the per-call focus question. 'full' returns the entire extracted page text (legacy behavior; can flood small-model context with boilerplate/metadata and degrade benchmark accuracy). 'disabled' removes the tool entirely so the agent works from search snippets only — useful for diagnosing whether fetching is helping or hurting accuracy. Note: This setting applies exclusively to the langgraph-agent strategy; pipeline strategies retrieve full page text upfront during search when search.snippets_only is disabled. | SEARCH || `search.final_max_results` | `LDR_SEARCH_FINAL_MAX_RESULTS` | `100` | Maximum unique sources to include in the final research output. Applied in pipeline/source-based strategies once after all search iterations complete, deduplicating and filtering across all accumulated results. Note: Autonomous agent strategies (like langgraph-agent) manage context autonomously and do not cap final results. | SEARCH || `search.iterations` | `LDR_SEARCH_ITERATIONS` | `3` | Number of search-and-refine cycles to run. Each iteration generates follow-up questions based on previous results to progressively deepen the research. More iterations yield better coverage but increase search and LLM API usage. | SEARCH || `search.journal_reputation.enable_llm_scoring` | `LDR_SEARCH_JOURNAL_REPUTATION_ENABLE_LLM_SCORING` | `false` | Enable Tier 4 LLM journal scoring via SearXNG. When disabled (default), only bundled data (OpenAlex, DOAJ, predatory lists) is used for scoring journal reputation. Tier 4 adds significant latency (1 SearXNG search + 1 LLM call per unknown journal) and only helps for journals outside the 217K-row reference DB. Requires SearXNG to be available. | SEARCH |@@ -616,7 +616,7 @@ They are not available in the Web UI because they are needed to start the applic| `search.search_strategy` | `LDR_SEARCH_SEARCH_STRATEGY` | `langgraph-agent` | Research methodology. 'source-based': Finds and extracts from sources (good for comprehensive research). 'focused-iteration': Uses entity-based progressive exploration (optimized for factual Q&A, ~95% SimpleQA accuracy, requires larger context windows). 'focused-iteration-standard': Comprehensive variant of focused-iteration with broader exploration. 'topic-organization': Organizes research around discovered topic clusters. 'langgraph-agent': Autonomous agentic research where the LLM decides what to search and when to synthesize. | SEARCH || `search.searches_per_section` | `LDR_SEARCH_SEARCHES_PER_SECTION` | `2` | Number of independent searches per report section when generating structured reports. Increases coverage but also increases API usage. | SEARCH || `search.skip_relevance_filter` | `LDR_SEARCH_SKIP_RELEVANCE_FILTER` | `true` | When checked, LLM-based relevance filtering is suppressed for general-purpose search engines that do not require it. Keyword-based engines (arXiv, PubMed, Wikipedia, GitHub, etc.) always run the filter regardless of this checkbox; per-engine settings override both. | SEARCH |-| `search.snippets_only` | `LDR_SEARCH_SNIPPETS_ONLY` | `true` | Only retrieve search snippets instead of full webpage content. Reduces API usage and processing time, but provides less context for analysis. | SEARCH |+| `search.snippets_only` | `LDR_SEARCH_SNIPPETS_ONLY` | `true` | Only retrieve search snippets instead of full webpage content for pipeline/source-based search strategies (source-based, iterative, topic organization, etc.). Reduces API usage and processing time, but provides less context for analysis. Note: Autonomous agent strategies (like langgraph-agent) always return snippets from web_search and retrieve full webpage content on-demand via the fetch_content tool (governed by search.fetch.mode). | SEARCH || `search.time_period` | `LDR_SEARCH_TIME_PERIOD` | `all` | Time range filter for search results. Limits results to content published within the specified period (day, week, month, year, or all time). | SEARCH || `search.tool` | `LDR_SEARCH_TOOL` | `searxng` | Search engine to use for research queries. The default langgraph-agent strategy can additionally pick specialized engines per query as tools. Each engine may require its own API key or service to be configured separately. | SEARCH || `security.account_lockout_duration_minutes` | `LDR_SECURITY_ACCOUNT_LOCKOUT_DURATION_MINUTES` | `15` | Duration in minutes that an account remains locked after exceeding the failed login threshold. Only configurable via environment variable (LDR_SECURITY_ACCOUNT_LOCKOUT_DURATION_MINUTES). | APP |diff --git a/src/local_deep_research/defaults/default_settings.json b/src/local_deep_research/defaults/default_settings.jsonindex f6f980491e..7193add033 100644--- a/src/local_deep_research/defaults/default_settings.json+++ b/src/local_deep_research/defaults/default_settings.json@@ -918,7 +918,7 @@},"search.fetch.mode": {"category": "search_parameters",- "description": "Controls the LangGraph agent's fetch_content tool. 'summary_focus_query' (default) asks the LLM to extract only spans relevant to a focus question the agent supplies per call AND the original research query, so vague focus can be disambiguated — keeps small-model context clean. 'summary_focus' is the same but uses only the per-call focus question. 'full' returns the entire extracted page text (legacy behavior; can flood small-model context with boilerplate/metadata and degrade benchmark accuracy). 'disabled' removes the tool entirely so the agent works from search snippets only — useful for diagnosing whether fetching is helping or hurting accuracy.",+ "description": "Controls the LangGraph agent's fetch_content tool. 'summary_focus_query' (default) asks the LLM to extract only spans relevant to a focus question the agent supplies per call AND the original research query, so vague focus can be disambiguated — keeps small-model context clean. 'summary_focus' is the same but uses only the per-call focus question. 'full' returns the entire extracted page text (legacy behavior; can flood small-model context with boilerplate/metadata and degrade benchmark accuracy). 'disabled' removes the tool entirely so the agent works from search snippets only — useful for diagnosing whether fetching is helping or hurting accuracy. Note: This setting applies exclusively to the langgraph-agent strategy; pipeline strategies retrieve full page text upfront during search when search.snippets_only is disabled.","editable": true,"max_value": null,"min_value": null,@@ -1439,7 +1439,7 @@},"search.snippets_only": {"category": "search_parameters",- "description": "Only retrieve search snippets instead of full webpage content. Reduces API usage and processing time, but provides less context for analysis.",+ "description": "Only retrieve search snippets instead of full webpage content for pipeline/source-based search strategies (source-based, iterative, topic organization, etc.). Reduces API usage and processing time, but provides less context for analysis. Note: Autonomous agent strategies (like langgraph-agent) always return snippets from web_search and retrieve full webpage content on-demand via the fetch_content tool (governed by search.fetch.mode).","editable": true,"max_value": null,"min_value": null,diff --git a/src/local_deep_research/web_search_engines/search_engine_factory.py b/src/local_deep_research/web_search_engines/search_engine_factory.pyindex 3ed49583a4..c2d7ab5320 100644--- a/src/local_deep_research/web_search_engines/search_engine_factory.py+++ b/src/local_deep_research/web_search_engines/search_engine_factory.py@@ -716,6 +716,9 @@ def get_search(})+ if search_tool == "searxng":+ params["use_full_search"] = not search_snippets_only+if search_tool in ["serpapi", "brave", "google_pse", "wikinews"]:params["search_language"] = search_languagediff --git a/tests/search_engines/test_search_engine_searxng.py b/tests/search_engines/test_search_engine_searxng.pyindex e6d5f8dea6..5f25c7ffd7 100644--- a/tests/search_engines/test_search_engine_searxng.py+++ b/tests/search_engines/test_search_engine_searxng.py@@ -948,3 +948,186 @@ class TestSearXNGInvokeMethod:engine.run.assert_called_once_with("test query")assert result == [{"title": "Test"}]+++class TestSearXNGFullSearchIntegration:+ """Tests for SearXNG integration with FullSearchResults wrapper via get_search/factory."""++ @pytest.fixture(autouse=True)+ def mock_safe_get(self, monkeypatch):+ """Mock safe_get for availability checks."""+ mock_response = Mock()+ mock_response.status_code = 200+ mock_response.cookies = {}+ mock_response.text = ""+ monkeypatch.setattr(+ "local_deep_research.web_search_engines.engines.search_engine_searxng.safe_get",+ Mock(return_value=mock_response),+ )++ def test_get_search_creates_full_search_wrapper_when_snippets_only_false(+ self,+ ):+ """get_search('searxng', search_snippets_only=False) wraps in FullSearchResults."""+ from local_deep_research.web_search_engines.engines.full_search import (+ FullSearchResults,+ )+ from local_deep_research.web_search_engines.engines.search_engine_searxng import (+ SafeSearchSetting,+ SearXNGSearchEngine,+ )+ from local_deep_research.web_search_engines.search_engine_factory import (+ get_search,+ )++ settings_snapshot = {+ "search.tool": {"value": "searxng"},+ "search.engine.web.searxng.supports_full_search": {"value": True},+ "search.engine.web.searxng.instance_url": {+ "value": "http://localhost:8080"+ },+ }+ engine = get_search(+ search_tool="searxng",+ llm_instance=Mock(),+ search_snippets_only=False,+ settings_snapshot=settings_snapshot,+ programmatic_mode=True,+ )++ assert isinstance(engine, FullSearchResults)+ assert isinstance(engine.web_search, SearXNGSearchEngine)+ assert engine.web_search.safe_search == SafeSearchSetting.OFF++ def test_get_search_returns_base_engine_when_snippets_only_true(self):+ """get_search('searxng', search_snippets_only=True) returns unwrapped engine."""+ from local_deep_research.web_search_engines.engines.full_search import (+ FullSearchResults,+ )+ from local_deep_research.web_search_engines.engines.search_engine_searxng import (+ SafeSearchSetting,+ SearXNGSearchEngine,+ )+ from local_deep_research.web_search_engines.search_engine_factory import (+ get_search,+ )++ settings_snapshot = {+ "search.tool": {"value": "searxng"},+ "search.engine.web.searxng.supports_full_search": {"value": True},+ "search.engine.web.searxng.instance_url": {+ "value": "http://localhost:8080"+ },+ }+ engine = get_search(+ search_tool="searxng",+ llm_instance=Mock(),+ search_snippets_only=True,+ settings_snapshot=settings_snapshot,+ programmatic_mode=True,+ )++ assert isinstance(engine, SearXNGSearchEngine)+ assert not isinstance(engine, FullSearchResults)+ assert engine.safe_search == SafeSearchSetting.OFF++ def test_get_search_returns_base_engine_when_supports_full_search_false(+ self,+ ):+ """get_search('searxng') returns unwrapped engine if supports_full_search is False."""+ from local_deep_research.web_search_engines.engines.full_search import (+ FullSearchResults,+ )+ from local_deep_research.web_search_engines.engines.search_engine_searxng import (+ SearXNGSearchEngine,+ )+ from local_deep_research.web_search_engines.search_engine_factory import (+ get_search,+ )++ settings_snapshot = {+ "search.tool": {"value": "searxng", "ui_element": "select"},+ "search.engine.web.searxng.supports_full_search": {+ "value": False,+ "ui_element": "checkbox",+ },+ "search.engine.web.searxng.instance_url": {+ "value": "http://localhost:8080",+ "ui_element": "text",+ },+ }+ engine = get_search(+ search_tool="searxng",+ llm_instance=Mock(),+ search_snippets_only=False,+ settings_snapshot=settings_snapshot,+ programmatic_mode=True,+ )++ assert isinstance(engine, SearXNGSearchEngine)+ assert not isinstance(engine, FullSearchResults)++ def test_full_search_wrapper_fetches_content_end_to_end(self, monkeypatch):+ """Test full execution of SearXNG through FullSearchResults wrapper."""+ from local_deep_research.web_search_engines.engines.full_search import (+ FullSearchResults,+ )+ from local_deep_research.web_search_engines.search_engine_factory import (+ get_search,+ )++ settings_snapshot = {+ "search.tool": {"value": "searxng", "ui_element": "select"},+ "search.engine.web.searxng.supports_full_search": {+ "value": True,+ "ui_element": "checkbox",+ },+ "search.engine.web.searxng.instance_url": {+ "value": "http://localhost:8080",+ "ui_element": "text",+ },+ }+ mock_llm = Mock()+ mock_llm.invoke.return_value = Mock(content="[0]")+ engine = get_search(+ search_tool="searxng",+ llm_instance=mock_llm,+ search_snippets_only=False,+ settings_snapshot=settings_snapshot,+ programmatic_mode=True,+ )+ assert isinstance(engine, FullSearchResults)++ # Mock base engine's run to return search previews+ mock_search_results = [+ {+ "title": "Result 1",+ "link": "https://example.com/page1",+ "snippet": "Snippet 1",+ }+ ]+ monkeypatch.setattr(+ engine.web_search,+ "run",+ Mock(return_value=mock_search_results),+ )++ # Mock SSRF validator+ monkeypatch.setattr(+ "local_deep_research.web_search_engines.engines.full_search.validate_url",+ Mock(return_value=True),+ )++ # Mock batch_fetch_and_extract+ monkeypatch.setattr(+ "local_deep_research.web_search_engines.engines.full_search.batch_fetch_and_extract",+ Mock(+ return_value={"https://example.com/page1": "Full Page 1 Text"}+ ),+ )++ results = engine.run("quantum computing")+ assert len(results) == 1+ assert results[0]["title"] == "Result 1"+ assert results[0]["link"] == "https://example.com/page1"+ assert results[0]["full_content"] == "Full Page 1 Text"diff --git a/tests/settings/golden_master_settings.json b/tests/settings/golden_master_settings.jsonindex 0bbf1d6ae0..d924fd7ef2 100644--- a/tests/settings/golden_master_settings.json+++ b/tests/settings/golden_master_settings.json@@ -8396,7 +8396,7 @@},"search.fetch.mode": {"category": "search_parameters",- "description": "Controls the LangGraph agent's fetch_content tool. 'summary_focus_query' (default) asks the LLM to extract only spans relevant to a focus question the agent supplies per call AND the original research query, so vague focus can be disambiguated — keeps small-model context clean. 'summary_focus' is the same but uses only the per-call focus question. 'full' returns the entire extracted page text (legacy behavior; can flood small-model context with boilerplate/metadata and degrade benchmark accuracy). 'disabled' removes the tool entirely so the agent works from search snippets only — useful for diagnosing whether fetching is helping or hurting accuracy.",+ "description": "Controls the LangGraph agent's fetch_content tool. 'summary_focus_query' (default) asks the LLM to extract only spans relevant to a focus question the agent supplies per call AND the original research query, so vague focus can be disambiguated — keeps small-model context clean. 'summary_focus' is the same but uses only the per-call focus question. 'full' returns the entire extracted page text (legacy behavior; can flood small-model context with boilerplate/metadata and degrade benchmark accuracy). 'disabled' removes the tool entirely so the agent works from search snippets only — useful for diagnosing whether fetching is helping or hurting accuracy. Note: This setting applies exclusively to the langgraph-agent strategy; pipeline strategies retrieve full page text upfront during search when search.snippets_only is disabled.","editable": true,"max_value": null,"min_value": null,@@ -8795,7 +8795,7 @@},"search.snippets_only": {"category": "search_parameters",- "description": "Only retrieve search snippets instead of full webpage content. Reduces API usage and processing time, but provides less context for analysis.",+ "description": "Only retrieve search snippets instead of full webpage content for pipeline/source-based search strategies (source-based, iterative, topic organization, etc.). Reduces API usage and processing time, but provides less context for analysis. Note: Autonomous agent strategies (like langgraph-agent) always return snippets from web_search and retrieve full webpage content on-demand via the fetch_content tool (governed by search.fetch.mode).","editable": true,"max_value": null,"min_value": null,diff --git a/tests/web_search_engines/test_search_engine_factory.py b/tests/web_search_engines/test_search_engine_factory.pyindex e44c61639e..61df5c8f23 100644--- a/tests/web_search_engines/test_search_engine_factory.py+++ b/tests/web_search_engines/test_search_engine_factory.py@@ -329,6 +329,60 @@ class TestGetSearch:assert call_kwargs["time_period"] == "m"assert call_kwargs["search_language"] == "Spanish"+ def test_get_search_with_searxng_params(self):+ """Test get_search with SearXNG only sets use_full_search without region or safe_search."""+ mock_llm = Mock()+ mock_engine = Mock()++ with patch(+ "local_deep_research.web_search_engines.search_engine_factory.create_search_engine"+ ) as mock_create:+ mock_create.return_value = mock_engine++ from local_deep_research.web_search_engines.search_engine_factory import (+ get_search,+ )++ get_search(+ search_tool="searxng",+ llm_instance=mock_llm,+ max_results=20,+ region="de",+ safe_search=False,+ search_snippets_only=False,+ settings_snapshot={"test": "value"},+ )++ call_kwargs = mock_create.call_args[1]+ assert "region" not in call_kwargs+ assert "safe_search" not in call_kwargs+ assert call_kwargs["use_full_search"] is True++ def test_get_search_with_searxng_snippets_only_true(self):+ """Test get_search with SearXNG when search_snippets_only=True."""+ mock_llm = Mock()+ mock_engine = Mock()++ with patch(+ "local_deep_research.web_search_engines.search_engine_factory.create_search_engine"+ ) as mock_create:+ mock_create.return_value = mock_engine++ from local_deep_research.web_search_engines.search_engine_factory import (+ get_search,+ )++ get_search(+ search_tool="searxng",+ llm_instance=mock_llm,+ max_results=10,+ search_snippets_only=True,+ settings_snapshot={"test": "value"},+ )++ call_kwargs = mock_create.call_args[1]+ assert call_kwargs["use_full_search"] is False+def test_get_search_returns_none(self):"""Test get_search when engine creation fails."""mock_llm = Mock()diff --git a/tests/web_search_engines/test_search_engine_factory_coverage.py b/tests/web_search_engines/test_search_engine_factory_coverage.pyindex f036734491..dc27531933 100644--- a/tests/web_search_engines/test_search_engine_factory_coverage.py+++ b/tests/web_search_engines/test_search_engine_factory_coverage.py@@ -1228,6 +1228,53 @@ class TestGetSearchParameterRouting:assert call_kwargs["use_full_search"] is Falseassert "search_language" not in call_kwargs+ def test_get_search_searxng_params(self):+ """searxng gets use_full_search based on search_snippets_only, without region/safe_search."""+ from local_deep_research.web_search_engines.search_engine_factory import (+ get_search,+ )++ with patch(+ "local_deep_research.web_search_engines.search_engine_factory.create_search_engine"+ ) as mock_create:+ mock_create.return_value = Mock(run=Mock())++ get_search(+ search_tool="searxng",+ llm_instance=Mock(),+ region="us",+ safe_search=False,+ search_snippets_only=False,+ settings_snapshot={"x": 1},+ )++ call_kwargs = mock_create.call_args[1]+ assert "region" not in call_kwargs+ assert "safe_search" not in call_kwargs+ assert call_kwargs["use_full_search"] is True+ assert "search_language" not in call_kwargs++ def test_get_search_searxng_snippets_only_true(self):+ """searxng with search_snippets_only=True sets use_full_search=False."""+ from local_deep_research.web_search_engines.search_engine_factory import (+ get_search,+ )++ with patch(+ "local_deep_research.web_search_engines.search_engine_factory.create_search_engine"+ ) as mock_create:+ mock_create.return_value = Mock(run=Mock())++ get_search(+ search_tool="searxng",+ llm_instance=Mock(),+ search_snippets_only=True,+ settings_snapshot={"x": 1},+ )++ call_kwargs = mock_create.call_args[1]+ assert call_kwargs["use_full_search"] is False+def test_get_search_programmatic_mode_forwarded(self):"""programmatic_mode is forwarded to create_search_engine."""from local_deep_research.web_search_engines.search_engine_factory import (