-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Allow adjusting search boost for title and tags fields #4512
Comments
Thanks for suggesting. Additional to boosts, there are some other parameters that we can expose to tune search, which is an excellent addition to the built-in search plugin. I'll cook something up in the coming weeks. |
I'll be revisiting this feature request shortly, as soon as beta 9 reaches a stable status and is released 😊 The reason why this takes some time is that the search was refactored and that first needs to be merged back into Insiders, so efforts are not duplicated. I'm sorry for the inconvenience, but it'll be worth the wait, as I'm planning other new interesting features for search that are made possible by the refactoring, including the things that were asked in this issue. |
Thanks for the update. I found a weighting that counteracts these built in boosts well enough for now, so this isn't urgent. |
plugins:
- search:
fields:
title:
boost: 0.5 # Current default: 1e3
tags:
boost: 2.0 # Current default: 1e6 Note that values currently need to be floats, so |
Exciting, thanks! Anyway you could automatically cast the numbers to floats? I feel like that's something I'll forget when using this feature. |
Absolutely agree, but I'm still fighting MkDocs config validation format 😅 Haven't found a way yet to use a union ( |
Fixed in |
Released as part of 9.0.13+insiders-4.31.0. |
Contribution guidelines
I want to suggest an idea and checked that ...
Description
Allow developers to adjust the search boost that comes from a search term matching the title or tags of a page. Currently these are hardcoded at 1e3 and 1e6 respectively.
mkdocs-material/src/assets/javascripts/integrations/search/_/index.ts
Lines 204 to 213 in ed6f0b1
Use Cases
You can tune search results with search boosting, and the page recommends starting with low values. However if you are trying to boost a page above another that has an exact match in the title, your boost must be greater than 1e3, which is quite huge. Allowing developer to adjust these constants would make it easier to tune search.
Screenshots / Mockups
Add entries somewhere in
mkdocs.yml
, perhaps undertheme
.The text was updated successfully, but these errors were encountered: