You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
when the (partial) name of a category is part of the search term, strip it from term and specify it as category query parameter instead
this has to be done client-side, as the server is (and will remain) unaware of translations
this could involve splitting the search term on whitespace, and running a string distance function on each word that compares the word with all translated category names
there are presently ~70 categories, with a 3 word term that would result in ~210 comparisons when performed naively
to bring down the category candidate amount, it would likely be beneficial to group them based on their first letter, and only attempt comparisons for term words with that same first letter
jaro-winkler distance (npm package) is a good candidate, as it weights similarity more heavily towards the start, than at the end, as opposed to e.g. levenshtein, which doesn't do positional weighting
this is just one approach, if the same result can be achieved with a different approach, that is fine as well
use tokenized search where appropriate
currently most filtering of "static" data follows the same pattern:
this approach falls short for multi-word terms with mismatching order or when an unrelated word is included
to solve this, a ranking approach should be adopted instead
category / manufacturer section of global search, category filter modal / sheet, and manufacturer filter modal / sheet are likely appropriate places to adopt tokenized search
regardless which library ends up being used, there should be a way to influence ranking based on e.g. submission count, and a way to highlight matching text segments
when the (partial) name of a category is part of the search term, strip it from term and specify it as
categoryquery parameter insteadthis has to be done client-side, as the server is (and will remain) unaware of translations
this could involve splitting the search term on whitespace, and running a string distance function on each word that compares the word with all translated category names
there are presently ~70 categories, with a 3 word term that would result in ~210 comparisons when performed naively
to bring down the category candidate amount, it would likely be beneficial to group them based on their first letter, and only attempt comparisons for term words with that same first letter
jaro-winkler distance (npm package) is a good candidate, as it weights similarity more heavily towards the start, than at the end, as opposed to e.g. levenshtein, which doesn't do positional weighting
this is just one approach, if the same result can be achieved with a different approach, that is fine as well
use tokenized search where appropriate
currently most filtering of "static" data follows the same pattern:
this approach falls short for multi-word terms with mismatching order or when an unrelated word is included
to solve this, a ranking approach should be adopted instead
category / manufacturer section of global search, category filter modal / sheet, and manufacturer filter modal / sheet are likely appropriate places to adopt tokenized search
potential libraries: fuse.js, MiniSearch, <insert-better-library-here>
regardless which library ends up being used, there should be a way to influence ranking based on e.g. submission count, and a way to highlight matching text segments