use a suffix array for searching
ImUrX opened this issue ยท 5 comments
i been adding better support for searching in vanilla minecraft and was thinking of mixin to this mod also but saw that you just use a contains for searching items.
A suffix array is much faster in searching because you just need to do 2 binary searches for finding all items with the substring you input
I'll have to read up on this, searching has always been a pretty temporary solution, since there is a lot of work that can be done to optimize it. Considering I have to search not only names but tooltips. EMI also supports regex, so raw string comparison is always going to be an issue.
Yeah, in short words, a suffix array is just an array filled of all possible suffixes of a string so a suffix array of "banana" would be "a", "na", "ana", etc. If you use non valid utf-8 characters as separators (-1
for example) you now have multiple strings in one suffix array. This only would work for just searching words that contain the same string, not for regex. I dont know how minecraft does tooltips storing but it does work with suffix arrays tho
I dont know how minecraft does tooltips storing but it does work with suffix arrays tho
What I meant is that Minecraft's current search tab and recipe book widget's search use the SuffixArray class