data-pagefind-weight not working as expected #740
-
In Hugo, I've added the following code to my topic templates:
Based on the following description, I'm expecting the titles of pages to be heavily weighted in search results. "Weightings are ranked using a quadratic scale, so a ranking of 2.0 will have roughly 4 times the impact of standard text, and a weighting of 10.0 will have roughly 100 times the impact." But I still get odd results. For example, if I search for release notes, with no surrounding quotes, a page with "release notes" in its title is below a page which merely has "release" (8 times) and "note" (once) separately in the text. If I search for "release notes" with quotes: the page with "release notes" in the title is the second result, below a page which just has "release notes" once in the text. (This is better at least than the default rating for H1s, 7, which gives its sixth place, and also how I know my code above is working.) If my titles now have a 100 times the weighting of results in the text, I don't understand why they are not at the top. P. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
👋 Hey @paulmoloneyr3 Yes, some of these ranking quirks are something I need to address soon. As of the newer ranking, these weights are intermixed with the BM25 system, which makes the results better by default but harder to intuit / customize. One example would be when a word is very common across a site — e.g. if every page contained the word At the moment the weight is given as an input to the ranking algorithm. It might make sense to use content with high weights like It'll need some testing and refinement so I can't promise there'll be big changes in the next release, but it's very top of mind for me so there will be some traction on this soon. |
Beta Was this translation helpful? Give feedback.
👋 Hey @paulmoloneyr3
Yes, some of these ranking quirks are something I need to address soon. As of the newer ranking, these weights are intermixed with the BM25 system, which makes the results better by default but harder to intuit / customize.
One example would be when a word is very common across a site — e.g. if every page contained the word
release
— then that word would only take a very small role in any given search's rankings. Not that this is necessarily the case you're hitting, but it's the kind of variable that can muddy the waters.At the moment the weight is given as an input to the ranking algorithm. It might make sense to use content with high weights like
data-pagefind-weig…