wagtail-nest / wagtail-whoosh

Search backend for Wagtail CMS using Whoosh engine.
24 stars 8 forks source link

Score order #1

Closed seb-b closed 5 years ago

seb-b commented 5 years ago

Order results by score rather than pk

Also added the option to annotate results with their score, similar to elastic search.

You can now do the following to mix multiple search results:

results = Page1.objects.search(query).annotate_score("_score").results()
result += Page2.objects.search(query).annotate_score("_score").results()
return sorted(results, key=lambda r: r._score)