DocuRAG / Api /app /infrastructure /repository /query_search_repository.py
abadesalex's picture
Update to Qdrant db
47b5f0c
raw
history blame
732 Bytes
from app.qdrant import QdrantConnectionDb
from qdrant_client.models import QueryResponse, Prefetch, NamedVector
class QuerySearchRepository:
def __init__(self, qdrant_connection_db: QdrantConnectionDb):
self.client = qdrant_connection_db.get_client()
self.collection_name = qdrant_connection_db.get_collection_name()
def find_text_by_hybrid_search(
self, prefetch_context: Prefetch, dense_vector: NamedVector
) -> QueryResponse:
return self.client.query_points(
collection_name=self.collection_name,
prefetch=prefetch_context,
query=dense_vector.vector,
using="text-dense",
with_payload=True,
limit=10,
)