-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathcheck_database.py
More file actions
64 lines (55 loc) · 2.3 KB
/
check_database.py
File metadata and controls
64 lines (55 loc) · 2.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/env python3
"""
Check database content and data volume
"""
import sys
import os
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'cellforge', 'Task_Analysis'))
from search import HybridSearcher
def check_database_content():
"""Check the content of databases"""
print("🔍 Checking Database Content")
print("=" * 50)
searcher = HybridSearcher()
# Check main database
if searcher.qdrant_main:
try:
collections = searcher.qdrant_main.get_collections()
print(f"📊 Main Database Collections:")
for col in collections.collections:
try:
count = searcher.qdrant_main.count(collection_name=col.name).count
print(f" - {col.name}: {count} documents")
except Exception as e:
print(f" - {col.name}: Error getting count - {e}")
except Exception as e:
print(f"❌ Main database connection failed: {e}")
# Check tmp database
if searcher.qdrant_tmp:
try:
collections = searcher.qdrant_tmp.get_collections()
print(f"\n📊 Tmp Database Collections:")
for col in collections.collections:
try:
count = searcher.qdrant_tmp.count(collection_name=col.name).count
print(f" - {col.name}: {count} documents")
except Exception as e:
print(f" - {col.name}: Error getting count - {e}")
except Exception as e:
print(f"❌ Tmp database connection failed: {e}")
# Test a simple search to see what we get
print(f"\n🧪 Testing Search with 'single cell'")
try:
results = searcher.search("single cell", limit=10)
print(f"📄 Search returned {len(results)} results")
if results:
print("📝 Sample results:")
for i, result in enumerate(results[:3], 1):
print(f" {i}. {result.title[:60]}... (score: {result.score:.3f})")
print(f" Source: {result.source}")
print(f" Snippet: {result.snippet[:100]}...")
print()
except Exception as e:
print(f"❌ Search test failed: {e}")
if __name__ == "__main__":
check_database_content()