✨ Ranking of aggregated search results based on relevancy of the search result to the user's search query #549
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Implements an algorithm to rank (in other words, sort) the aggregated search results according to the relevancy of the search result based on the user's search query by analyzing three properties of the search results:
Also, check each of the properties for how closely they are related if they are too closely related then it should be the first result in all search results. If it is the least related, then it should be the last result to be shown in all the search results.
Chosen Ranking function: TF-IDF (Term Frequency-Inverse Document Frequency)
This is a weighting scheme often used by search engines as a central tool in scoring and ranking a document's relevance given a user query, find implementation details below:
use-synonyms-search
oruse-non-static-synonyms-search
.Caution
This feature flag enables using an offline thesaurus library (moby) to find synonyms and add them to the relevance calculations), there is both a performance and binary size cost when this feature is used..
For more information on this ranking function, check out this article
Why is this change important?
Currently, the Search engine doesn't sort results by importance or relevance. This PR aims to solve that.
How to test this PR locally?
It can be tested by installing and running Websurfx as mentioned in the docs and on the readme and by launching the browser and thoroughly testing. On searching for a topic, you find that the most relevant results are returned first .
To try out using synonyms, build or run Websurfx with the feature flag
use-synonyms-search
Related issues
Closes #393