Open hadar-co opened 1 month ago
How would you want the order be configured?
Under the hood, we use lunr.js to do the search job, which will order the results by the relevant score to the search keywords for each document.
On the top level, we separates each document to 3 parts: page titles, section titles, and contents. We always put page titles before section titles, and put section titles before contents.
thanks for the info, that's helpful, I think it could be useful to mention that in your readme:)
One option I can think of to help control the order is the ability to prioritize attributes so that they have more weight than others. Attributes like "number of times the word appears in the page".
Another option is to support tags on pages, so that if someone searches for a keyword and it exists as a tag on a page, that will be the top result.
I'm seeing the same functional issue here.
A quick idea I have is to maybe add "weight" when explicit keywords
values were set?
https://docusaurus.io/docs/next/seo#single-page-metadata
e.g. you have multiple pages containing the foobar
word (FAQ, changelogs, various pages mentioning it) but you want most users to find the "foobar
Guide" as the first result. Then, the search plugin should consider this page as "weighted", because of it's keywords: foobar
usage . We rely on the keywords
feature because it already exists, it's an opt-in, meant for SEO (and so if you put a keyword there, it already means that you consider it important).
Or maybe it should use a dedicated flag instead, such as weighted_search_keywords
or something.
Currently, I don't see a way to configure how results should be ordered. The current behavior works well for some search terms, but not as well for others.
Is there a way to change it? Perhaps choose one or more attributes by which to order the results?