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.

Fix search result count tracking in source-based strategy

LearningCircuit2fbd8ef7d8f8
diff --git a/src/local_deep_research/advanced_search_system/strategies/source_based_strategy.py b/src/local_deep_research/advanced_search_system/strategies/source_based_strategy.py
index 55dc4dbae4..38d27de0ef 100644
--- a/src/local_deep_research/advanced_search_system/strategies/source_based_strategy.py
+++ b/src/local_deep_research/advanced_search_system/strategies/source_based_strategy.py
@@ -8,6 +8,7 @@ from ...config.llm_config import get_llm
from ...config.search_config import get_search
from ...utilities.db_utils import get_db_setting
from ...utilities.threading_utils import thread_context, thread_with_app_context
+from ...utilities.thread_context import preserve_research_context
from ..filters.cross_engine_filter import CrossEngineFilter
from ..findings.repository import FindingsRepository
from ..questions.atomic_fact_question import AtomicFactQuestionGenerator
@@ -211,6 +212,7 @@ class SourceBasedSearchStrategy(BaseSearchStrategy):
# Function for thread pool
@thread_with_app_context
+ @preserve_research_context
def search_question(q):
try:
result = self.search.run(q)