~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
Delete scripts/test_unified_indexing.py
LearningCircuit6738ecf86cab
diff --git a/scripts/test_unified_indexing.py b/scripts/test_unified_indexing.pydeleted file mode 100644index deb014db3a..0000000000--- a/scripts/test_unified_indexing.py+++ /dev/null@@ -1,129 +0,0 @@-#!/usr/bin/env python3-"""-Test script for unified document architecture with proper collection-based indexing.-This script verifies that the refactoring works correctly.-"""--import sys-from pathlib import Path--# Add src to path-sys.path.insert(0, str(Path(__file__).parent.parent / "src"))--from local_deep_research.database.session_context import get_user_db_session-from local_deep_research.database.library_init import (- get_default_library_id,- get_source_type_id,-)-from local_deep_research.database.models.library import (- Document,- Collection,- DocumentCollection,-)-from loguru import logger---def test_unified_indexing(username: str):- """Test the unified document indexing system."""- logger.info(f"Testing unified indexing for user: {username}")-- try:- with get_user_db_session(username) as session:- # Test 1: Check source types exist- logger.info("\n=== Test 1: Source Types ===")- source_types = ["research_download", "user_upload", "manual_entry", "api_import"]- for st_name in source_types:- try:- st_id = get_source_type_id(username, st_name)- logger.info(f" ✓ {st_name}: {st_id}")- except Exception as e:- logger.error(f" ✗ {st_name}: {e}")- return False-- # Test 2: Check Library collection exists- logger.info("\n=== Test 2: Library Collection ===")- library_id = get_default_library_id(username)- library = session.query(Collection).filter_by(id=library_id).first()- if library:- logger.info(f" ✓ Library collection found: {library.name} (ID: {library_id})")- logger.info(f" - is_default: {library.is_default}")- else:- logger.error(f" ✗ Library collection not found")- return False-- # Test 3: Check Document model structure- logger.info("\n=== Test 3: Document Model ===")- doc_count = session.query(Document).count()- logger.info(f" Total documents: {doc_count}")-- if doc_count > 0:- sample_doc = session.query(Document).first()- logger.info(f" Sample document:")- logger.info(f" - ID: {sample_doc.id}")- logger.info(f" - Title: {sample_doc.title}")- logger.info(f" - Source Type ID: {sample_doc.source_type_id}")- logger.info(f" - Has text content: {bool(sample_doc.text_content)}")- logger.info(f" - Text length: {len(sample_doc.text_content) if sample_doc.text_content else 0} chars")-- # Check for deprecated fields (should NOT exist)- if hasattr(sample_doc, 'rag_indexed'):- logger.error(" ✗ DEPRECATED: Document still has rag_indexed field!")- return False- if hasattr(sample_doc, 'chunk_count') and hasattr(sample_doc, 'indexed'):- logger.error(" ✗ DEPRECATED: Document still has chunk_count field!")- return False- logger.info(" ✓ Document model clean (no deprecated fields)")-- # Test 4: Check DocumentCollection structure- logger.info("\n=== Test 4: DocumentCollection ===")- doc_collection_count = session.query(DocumentCollection).count()- logger.info(f" Total DocumentCollection entries: {doc_collection_count}")-- if doc_collection_count > 0:- sample_link = session.query(DocumentCollection).first()- logger.info(f" Sample DocumentCollection:")- logger.info(f" - Document ID: {sample_link.document_id}")- logger.info(f" - Collection ID: {sample_link.collection_id}")- logger.info(f" - Indexed: {sample_link.indexed}")- logger.info(f" - Chunk count: {sample_link.chunk_count}")- logger.info(f" - Last indexed: {sample_link.last_indexed_at}")- logger.info(" ✓ DocumentCollection structure correct")-- # Test 5: Check indexing statistics per collection- logger.info("\n=== Test 5: Indexing Statistics ===")- collections = session.query(Collection).all()- for coll in collections:- indexed_count = (- session.query(DocumentCollection)- .filter_by(collection_id=coll.id, indexed=True)- .count()- )- total_count = (- session.query(DocumentCollection)- .filter_by(collection_id=coll.id)- .count()- )- logger.info(f" Collection '{coll.name}' (ID: {coll.id}):")- logger.info(f" - Total documents: {total_count}")- logger.info(f" - Indexed documents: {indexed_count}")- logger.info(f" - Not indexed: {total_count - indexed_count}")-- logger.info("\n" + "=" * 50)- logger.info("✓ ALL TESTS PASSED - Unified indexing working correctly!")- logger.info("=" * 50 + "\n")- return True-- except Exception as e:- logger.exception(f"✗ Test failed: {e}")- return False---if __name__ == "__main__":- if len(sys.argv) < 2:- print("Usage: python test_unified_indexing.py <username>")- print("Example: python test_unified_indexing.py a0006")- sys.exit(1)-- username = sys.argv[1]- success = test_unified_indexing(username)- sys.exit(0 if success else 1)