0

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.

5
  • It'd help to show what you've already tried. Nov 20, 2017 at 21:41
  • I edited my question(Added some relevant code)! Nov 20, 2017 at 22:33
  • Maybe this might help github.com/alvations/shiva-something/blob/master/…
    – alvas
    Nov 21, 2017 at 1:59
  • Did using the default ix.searcher() return what you need? Try that first, then update the weighting parameter to BM25F later.
    – alvas
    Nov 21, 2017 at 2:00
  • Yep ix.searcher() returned the results. But I want to sort the results based on how relevant it is to the Query. Any idea how to rank the results? Nov 21, 2017 at 2:52

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.