-
-
Notifications
You must be signed in to change notification settings - Fork 369
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Flexsearch result are not ordered by relevance. #1216
Comments
Thanks. I'll have a closer look later (I'm a bit busy)— I will get back to you then |
+1 to this, I am also having this issue. A user searches for "Risk Acceptance" but the page actually called "Risk Acceptance" is at the bottom of the results. |
I got around to trying @Maximilien-Lepivain-Wiztivi 's suggested code changes to Just wanted to put this here in case someone else needs it - I don't fully get Node.js so I'm not sure where to propose the changes on the actual file. This is a good enough workaround for our purposes. ![]() ![]() |
Thanks for sharing, I will have a further look into this (leaving this issue open) |
Description
When doing a search throughout the documentation, the result are not ordered by relevance which makes search less efficient than it could be.
Steps to reproduce
I can't provide a demo.
I can detail my example and propose the fix that I have done on my side.
Expected result
Both pages indeed contain the word "performance" but the dedicated page should be proposed first.
Actual result
The page titled "Configuration" is proposed before the page entitled "Performance".
Environment
Proposed fix:
From my understanding, Flexsearch is providing result in relevance order, however the
flexsearch.js
wrapper in@hyas/assets/js/flexSearch.js
is implicitly reordering the result due to the way data are aggregating before display. The function do search is aggegrating result by there index in a map:The issue is that when you do Object.keys on result, the order is not relevance given by Flexsearch anymore but the id number.
If you want to aggregate on id you also need to keep the order of the document provided by Flexsearch as follow (it's a tiny bit dirty):
The result, feels more relevant that way, on our case. "Performance" page was proposed first other felt much more relevant.
Don't hesitate to tell me, if I miss something or got something wrong.
The text was updated successfully, but these errors were encountered: