leo-buneev / vuepress-plugin-fulltext-search

Adds full-text search capabilities to your vuepress site with a help of flexsearch library.
MIT License
93 stars 23 forks source link

Understand the top category #25

Open tchiotludo opened 3 years ago

tchiotludo commented 3 years ago

Thanks for this great plugin ! Really better than the default one, and since I don't want to use a third party search engine, it fill all my need.

Just a case I don't understand : I used it here : https://kestra.io/ and source code is here : https://github.com/kestra-io/kestra.io

I have a structure with folder, subfolder and 2 side bar : https://github.com/kestra-io/kestra.io/blob/master/.vuepress/config.js#L38

For examples this page : https://kestra.io/docs/developer-guide/errors-handling/ When I search for some content on this page : image

The top navbar is always showing the index of the side bat when I hope to show the previous page developer-guide.

Thanks

leo-buneev commented 3 years ago

Issue is here:

https://github.com/leo-buneev/vuepress-plugin-fulltext-search/blob/master/services/flexsearchSvc.js#L107

The idea is to show "top-most" category, and plugin does that by finding document corresponding to first path slice for each page.

On your website there are 2 top-level paths: /docs/(with title "What’s Kestra?") and /plugins/ (with title "Overview").

I think it's reasonable default behaviour, but I agree that on your website lower level may look better.

Feel free to create PR ( for example, add setting "topCategoryLevel"), or I'll do it myself when I'll have free time (in a week or 2, sorry).