jekyll-lunr-js-search
jekyll-lunr-js-search copied to clipboard
Search results are not sorted
I am using jekyll-lunr-js-search on my Jekyll test site:
But the search results are not sorted in any meaningful way. I have changed the "displaydate" return format in the search.min.js file.
If I search for update, the results are:
03 April 2014 · You're up and running! 03 March 2014 · Hello What Ever 2014 03 March 2015 · You good to go 03 March 2013 · Hello What Ever 2013 03 March 2015 · Hello What Ever 2015
The same issue is also seen on the "official" demo site:
I would actually like to sort on the "pubdate" string, but display the "displaydate" string.
Agreed that some support for sorting would be nice!
Lunr orders search results by their relevance:
Results will be returned sorted by their score, the most relevant results will be returned first. -- Lunr
I'm happy to accept a pull request to provide an override to order results to your preference.
Ok thanks, I figured it was something like that. I wonder if there's a way to tweak the settings so that it excludes certain elements from scoring. For instance, if you wanted to match based on title only or something.
It's just a little strange that results like this https://coeurdecode.com/search?q=unity show up in a strange order.
I also wonder if it's not sorting by date as a secondary when two scores are tied.