-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make site-search results score-debugging optional (mdn#2868)
* Make site-search results score-debugging optional Fixes mdn#2866 * Update docs/debugging-sitesearch.md Co-authored-by: Ryan Johnson <[email protected]> Co-authored-by: Ryan Johnson <[email protected]>
- Loading branch information
Showing
3 changed files
with
39 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 1,32 @@ | ||
# Debugging site-search | ||
|
||
## How it works | ||
|
||
Site-search is done via Kuma and Elasticsearch. The default way, when you sort | ||
by "Best" is that it combines the match with each documents' popularity number. | ||
This hopefully gives the best possible results as it elevates popular documents, | ||
on the assumption that it's more likely to be what you're looking for, with how | ||
much the title and body matches the search string. | ||
|
||
This metadata is always included in the search results JSON from Kuma. But | ||
displaying it in Yari is optional. | ||
|
||
## How to enable it | ||
|
||
To display each search results `score` and `popularity`, set this in your `.env`: | ||
|
||
REACT_APP_DEBUG_SEARCH_RESULTS=true | ||
|
||
Now, when you open <http://localhost:3000/en-US/search?q=test> the `score` | ||
and `popularity` is shown. | ||
|
||
## How to use it | ||
|
||
You can't affect the sorting algorithm in Yari. To try out different techniques | ||
for the `function_score` in the Python Elasticsearch code, you have to | ||
make changes within Kuma to try different combinations such as `popularity_factor` | ||
and `boost_mode` and `score_mode`. Most of these values are currently hardcoded in | ||
the Kuma Python code. | ||
|
||
It's hard to predict exactly what users really prefer and a lot of it depends | ||
on learning from how people react to the sorting. |