File size: 732 Bytes
47b5f0c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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,
        )