Hi there! Lovely theme. I use it for a site that helps searching for card rulings in a card game: https://edisonrul.ing/
I noticed that when the search query is incomplete, the results are unintituitive. For example, searching for the card "Lonefire Blossom", I would expect it to show up near the top of the results after "Lon" or "Lone". However, this is what I see instead:
1. Lon
Details
Cards that contain lon but don't start with lon are prioritized (alphabetical order), such that "Lone" cards are buried in the results.
2. Lone
Details
Now that the search has found exact matches ("Lone Wolf"), all of the other partial matches are excluded from the preview. (Note: Typing in "Lonef" instead will cause the non-exact matches to return again.)
Is it possible that this behavior is due to the weighting in sphinx_search.ts?
|
// query matches the full name of an object |
|
objNameMatch: 11, |
|
// or matches in the last dotted part of the object name |
|
objPartialMatch: 6, |
|
// Additive scores depending on the priority of the object |
|
objPrio: { |
|
0: 15, // used to be importantResults |
|
1: 5, // used to be objectResults |
|
2: -5 |
|
} as Record<number, number>, // used to be unimportantResults |
|
// Used when the priority is not in the mapping. |
|
objPrioDefault: 0, |
|
|
|
// query found in title |
|
title: 15, |
|
partialTitle: 7, |
|
// query found in terms |
|
term: 5, |
|
partialTerm: 2 |
|
} |
I notice that the lunr.js implementation on the mkdocs-material site doesn't seem to suffer from these same issues. For example, searching for "Se" will return "Setup" and "Setting up your site" before "Built-in search plugins" (i.e. non-alphabetical). Hence my thinking that this behavior might be due to sphinx-immaterial's own search weighting.
Curious to learn more about how the default search works! Thanks again. <3
Hi there! Lovely theme. I use it for a site that helps searching for card rulings in a card game: https://edisonrul.ing/
I noticed that when the search query is incomplete, the results are unintituitive. For example, searching for the card "Lonefire Blossom", I would expect it to show up near the top of the results after "Lon" or "Lone". However, this is what I see instead:
1.
LonDetails
Cards that contain
lonbut don't start withlonare prioritized (alphabetical order), such that "Lone" cards are buried in the results.2.
LoneDetails
Now that the search has found exact matches ("Lone Wolf"), all of the other partial matches are excluded from the preview. (Note: Typing in "Lonef" instead will cause the non-exact matches to return again.)
Is it possible that this behavior is due to the weighting in
sphinx_search.ts?sphinx-immaterial/src/templates/assets/javascripts/sphinx_search.ts
Lines 86 to 105 in f8f746f
I notice that the
lunr.jsimplementation on themkdocs-materialsite doesn't seem to suffer from these same issues. For example, searching for "Se" will return "Setup" and "Setting up your site" before "Built-in search plugins" (i.e. non-alphabetical). Hence my thinking that this behavior might be due tosphinx-immaterial's own search weighting.Curious to learn more about how the default search works! Thanks again. <3