Example of hybrid search for our indexed data

from dotenv import load_dotenv


load_dotenv("../../.env")
True
from juddges.retrieval.mongo_hybrid_search import run_hybrid_search
from os import environ


from pymongo import MongoClient


client = MongoClient(environ["MONGO_URI"])
collection = client.get_database("datasets").get_collection("pl-court")
# collection.find_one()
from sentence_transformers import SentenceTransformer
/opt/conda/lib/python3.10/site-packages/sentence_transformers/cross_encoder/CrossEncoder.py:11: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html
  from tqdm.autonotebook import tqdm, trange
model = SentenceTransformer("sdadas/mmlw-roberta-large")
/opt/conda/lib/python3.10/site-packages/huggingface_hub/file_download.py:1132: FutureWarning: `resume_download` is deprecated and will be removed in version 1.0.0. Downloads always resume when possible. If you want to force a new download, use `force_download=True`.
  warnings.warn(
query = "kara śmierci"
embedding = model.encode(query).tolist()
# embedding
results = list(
    run_hybrid_search(
        collection=collection,
        collection_name="pl-court",
        query=query,
        embedding=embedding,
    )
)
results