-
Is it possible to set the sort order of search results on the dedicated search page? Right now, results are presented in an arbitrary order, at least it looks like this to me. IMHO, respecting the order as given by the menu entries would make sense. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
Although there are plans to add more options to the dedicated search page (#407), ordering is currently solely done by Lunr based on the configuration we are setting. Lunr calculates a weight based on these settings and sorts accordingly. This will not change even more options are implemented. So the only way to achieve this is by setting diddferent configuration settings for Lunr. Nevertheless I doubt, that sorting by menu order is a good idea for search results as the pages with a higher weight may get listed far at the bottom. |
Beta Was this translation helpful? Give feedback.
"Soon" as in "soon™" ;-)
Seriously, I do not plan to implement it in the next three month. But you never know - sometimes priorities shift. Nevertheless, this is very high on my list - after I fixed a few other things. So realisticly this will come somewhere around this year.
If you want to take a look into this,
static/search.js
is the place of interest. That's where Lunr is initialized. You'll most likly need to take a look into their documentation. If you need furhter data for the search index, you need to changelayouts/_default/index.json
(deprecated but still supported) andlayouts/_default/index.search.js
(the hot new stuff).