So, I am working on a search engine. We have two indexed corpora and some relevant queries based on the corpora. After running the query , we are getting top 10 results. Now I am trying to rank/score the results according to their relevance. I was looking up the BM25F algorithm and I can't figure out how to use the algorithm in Whoosh.
with ix.searcher(weighting = whoosh.scoring.BM25F()) as searcher:
query_text = QueryParser("stem_text", ix.schema,
termclass=query.Variations, group= qparser.OrGroup).parse(
"what is something pretty astonishing?")
results = searcher.search(query_text, sortedby= scores, limit = 10)
for hit in results:
print(hit["stem_text"])
I would like to apply the BM25F algorithm on the results.