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: ensure PubMed abstracts are fetched in snippet-only mode

LearningCircuit776ffa1261e5
diff --git a/src/local_deep_research/web_search_engines/engines/search_engine_pubmed.py b/src/local_deep_research/web_search_engines/engines/search_engine_pubmed.py
index ccd69984db..1dcdf78f11 100644
--- a/src/local_deep_research/web_search_engines/engines/search_engine_pubmed.py
+++ b/src/local_deep_research/web_search_engines/engines/search_engine_pubmed.py
@@ -962,12 +962,17 @@ The default assumption should be that medical and scientific queries want RECENT
List of result dictionaries with full content
"""
# Check if we should add full content
- if (
+ snippets_only_mode = (
hasattr(search_config, "SEARCH_SNIPPETS_ONLY")
and search_config.SEARCH_SNIPPETS_ONLY
- ):
- logger.info("Snippet-only mode, skipping full content retrieval")
- return relevant_items
+ )
+
+ if snippets_only_mode:
+ logger.info(
+ "Snippet-only mode enabled, will fetch abstracts as snippets"
+ )
+ # For PubMed, we still need to fetch abstracts as they serve as snippets
+ # But we'll skip full-text retrieval
logger.info(
f"Getting content for {len(relevant_items)} PubMed articles"
@@ -980,13 +985,14 @@ The default assumption should be that medical and scientific queries want RECENT
pmids.append(item["_pmid"])
# Get abstracts if requested and PMIDs exist
+ # In snippet-only mode, always get abstracts as they serve as snippets
abstracts = {}
- if self.get_abstracts and pmids:
+ if (self.get_abstracts or snippets_only_mode) and pmids:
abstracts = self._get_article_abstracts(pmids)
- # Find PMC IDs for full-text retrieval (if enabled)
+ # Find PMC IDs for full-text retrieval (if enabled and not in snippet-only mode)
pmid_to_pmcid = {}
- if self.get_full_text and pmids:
+ if self.get_full_text and pmids and not snippets_only_mode:
pmid_to_pmcid = self._find_pmc_ids(pmids)
# Add content to results
@@ -999,8 +1005,18 @@ The default assumption should be that medical and scientific queries want RECENT
if pmid in abstracts:
result["abstract"] = abstracts[pmid]
+ # In snippet-only mode, use abstract as snippet
+ if snippets_only_mode:
+ result["snippet"] = (
+ abstracts[pmid][:500]
+ if len(abstracts[pmid]) > 500
+ else abstracts[pmid]
+ )
+ result["full_content"] = abstracts[pmid]
+ result["content"] = abstracts[pmid]
+ result["content_type"] = "abstract"
# Use abstract as content if no full text
- if pmid not in pmid_to_pmcid:
+ elif pmid not in pmid_to_pmcid:
result["full_content"] = abstracts[pmid]
result["content"] = abstracts[pmid]
result["content_type"] = "abstract"