tantivy-py icon indicating copy to clipboard operation
tantivy-py copied to clipboard

Adding document based scoring

Open AliFlux opened this issue 1 year ago • 1 comments

Hi,

Is there a way to score some documents higher than others? Something like weight in whoosh?

For example: In an ecommerce site, we can have a popularity field for each items. And when user searches for something, the popular documents appear on top.

This is already implemented in tantivy core repo: https://docs.rs/tantivy/0.10.3/tantivy/collector/struct.TopDocs.html#example

I understand that bringing the callback from rust to python may make it slower. Therefore the python interface should be pretty simple. E.g. searcher.search(query, weight_by='popularity')

AliFlux avatar Jul 13 '22 09:07 AliFlux

@AliFlux What about adding BooleanQuery in the query, where popular items are additionally added some scores?

alex-au-922 avatar Apr 23 '24 01:04 alex-au-922