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: Add detailed logging to debug citation tracking issues

LearningCircuit300ba5a53e25
diff --git a/src/local_deep_research/web_search_engines/engines/search_engine_paperless.py b/src/local_deep_research/web_search_engines/engines/search_engine_paperless.py
index 1cd99f3295..b6ae491adc 100644
--- a/src/local_deep_research/web_search_engines/engines/search_engine_paperless.py
+++ b/src/local_deep_research/web_search_engines/engines/search_engine_paperless.py
@@ -589,9 +589,18 @@ Include synonyms, plural forms, and technical terms."""
# If content inclusion is disabled, just return previews
return relevant_items
+ logger.info(f"Getting full content for {len(relevant_items)} documents")
results = []
- for item in relevant_items:
+ for idx, item in enumerate(relevant_items):
try:
+ logger.info(
+ f"Processing document {idx + 1}: title='{item.get('title', 'No title')[:50]}...', url={item.get('url', 'No URL')}"
+ )
+ logger.debug(f"Document {idx + 1} keys: {item.keys()}")
+ logger.debug(
+ f"Document {idx + 1} has snippet of length: {len(item.get('snippet', ''))}"
+ )
+
# Get the full document content if we have the raw data
if "_raw_data" in item:
doc_data = item["_raw_data"]
@@ -610,9 +619,20 @@ Include synonyms, plural forms, and technical terms."""
)
item["full_content"] = full_content or item["snippet"]
+ logger.info(
+ f"Document {idx + 1} full content length: {len(item['full_content'])}"
+ )
else:
# Fallback to snippet if no raw data
item["full_content"] = item["snippet"]
+ logger.info(
+ f"Document {idx + 1} using snippet as full content (no raw data)"
+ )
+
+ # Log the final document structure for debugging citation issues
+ logger.info(
+ f"Document {idx + 1} final structure: title='{item.get('title', '')[:50]}...', has_link={bool(item.get('link'))}, has_url={bool(item.get('url'))}, source='{item.get('source', 'Unknown')}'"
+ )
# Remove the raw data from the result
item.pop("_raw_data", None)
@@ -659,6 +679,13 @@ Include synonyms, plural forms, and technical terms."""
# Get full content for relevant items
results = self._get_full_content(filtered_previews)
+ logger.info(
+ f"Search completed successfully, returning {len(results)} results"
+ )
+ logger.info(
+ f"Results summary: {[{'title': r.get('title', '')[:30], 'url': r.get('url', '')[:50]} for r in results[:3]]}"
+ )
+
return results
except Exception: