27 lines
834 B
Python
27 lines
834 B
Python
import sys
|
|
import os
|
|
sys.path.append(os.path.join(os.getcwd(), 'docengine'))
|
|
|
|
from app.core.database import SessionLocal
|
|
from app.models.document import Document
|
|
from app.services.matching_service import MatchingService
|
|
|
|
db = SessionLocal()
|
|
doc = db.query(Document).order_by(Document.created_at.desc()).first()
|
|
if not doc:
|
|
print("No documents found.")
|
|
sys.exit(0)
|
|
|
|
print(f"Latest document: {doc.id} (status: {doc.status})")
|
|
|
|
svc = MatchingService(db)
|
|
try:
|
|
# Match with min_confidence=0.0 so it returns EVERYTHING
|
|
matches = svc.match_document(doc.id, min_confidence=0.0)
|
|
print(f"Returned {len(matches)} matches.")
|
|
for m in matches:
|
|
print(f"Match: format_id={m.format_id}, score={m.confidence_score}")
|
|
print(f"Details: {m.match_details}")
|
|
except Exception as e:
|
|
print(f"Error matching: {e}")
|