cmfcmf / docusaurus-search-local

Offline / Local Search for Docusaurus v2. Try it live at:
https://cmfcmf.github.io/OpenWeatherMap-PHP-API/
MIT License
438 stars 67 forks source link

Add support for defining lunr similarity tuning parameters and custom search boost factors #67

Closed JulesBlm closed 2 years ago

JulesBlm commented 2 years ago

Hi, thanks for this great package. I needed to tweak the lunr similarity tuning parameters and boosts slightly to improve the search results. This PR add supports for defining these (parameters b and k1) and boost factors for title and content matches in the lunr field in the config options. The defaults are the same as they used to be: b = 0.75, k1 = 1.2, titleBoost = 5, and contentBoost = 1.

All tests pass and some testing with my docs showed that my search results got better.

cmfcmf commented 2 years ago

Thank you @JulesBlm, and sorry for the delay! I made some minor changes and also made the boost of parent categories configurable. Could you share the settings you ended up using for your docs? Maybe the current defaults (especially the boost values) are not the best they could be.