~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
refactor: replace raw SQL INSERT OR REPLACE with ORM merge()
LearningCircuit8f906b082380
diff --git a/src/local_deep_research/research_library/services/library_rag_service.py b/src/local_deep_research/research_library/services/library_rag_service.pyindex 2f8caded89..19d6af8eda 100644--- a/src/local_deep_research/research_library/services/library_rag_service.py+++ b/src/local_deep_research/research_library/services/library_rag_service.py@@ -579,22 +579,15 @@ class LibraryRAGService:# Row existence = indexed, simple and cleantimestamp = datetime.now(UTC)- # Using raw SQL for INSERT OR REPLACE as SQLite-specific optimization- # This atomically upserts the record without separate query+insert logic- session.execute(- text("""- INSERT OR REPLACE INTO rag_document_status- (document_id, collection_id, rag_index_id, chunk_count, indexed_at)- VALUES (:doc_id, :coll_id, :index_id, :chunk_count, :timestamp)- """),- {- "doc_id": document_id,- "coll_id": collection_id,- "index_id": self.rag_index_record.id,- "chunk_count": len(chunks),- "timestamp": timestamp,- },+ # Create or update RagDocumentStatus using ORM merge (atomic upsert)+ rag_status = RagDocumentStatus(+ document_id=document_id,+ collection_id=collection_id,+ rag_index_id=self.rag_index_record.id,+ chunk_count=len(chunks),+ indexed_at=timestamp,)+ session.merge(rag_status)logger.info(f"Marked document as indexed in rag_document_status: doc_id={document_id}, coll_id={collection_id}, chunks={len(chunks)}"