PuzzleTechHub/nutrimatic

Handle queries with wildcard at the front better

Opened this issue · 2 comments

Right now queries like https://nutrimatic.org/?q=_*word&go=Go either take forever to load, or just go straight to resource limit exceeded. You need workarounds like https://nutrimatic.org/?q=A%7B4%2C10%7D%26_*word&go=Go to make those queries work.

In comparision, queries with wildcards at the back like https://nutrimatic.org/?q=word_*&go=Go have never faced any errors at all.

Maybe something can be done to let Nutrimatic handle things better both directions?

Someone mentioned reverse trie earlier about this

One could certainly build a reverse index (at the expense of doubling index size...) but even that wouldn't be general, because _*word_* will be slow regardless. But maybe suffix searching is common enough to be worth indexing for?