back

by padolsey·3y ago·view on hn ↗
Looks really good - pleasant UX and seems nicely semantic/accessible! Also seems to allow slight mispellings which I really like.

I tried building my own autocomplete thing for ablf.io and it was *tough*. The dataset was massive, over 400k canonical titles. And I wanted to split out different variants/localizations of the titles/authors so it's much more than that really. I ended up using the 'trie-search' npm package as that was really the only way get decent performance. I also did some hueristic levenstein distance stuff to order the results most optimally for the user. I found it helpful to add variants to the trie with vowels and common conjuctions like 'The' and 'A' removed – since people tend to forget those when searching for book titles (then when searching across the trie I can attempt different variants).

I guess the main learnings are: it's important to pay attention to the type of data you've got and how users will try to access it; don't assume they know titles of things nor the spelling. Use trie structures! Also: with large datasets it's beneficial to do upfront data prepartion to build variants. RAM is pretty cheap. Thinking... I imagine "AI semantic autocomplete" will be happening pretty soon which is exciting.

1 comments
We use Algolia, and we have an index of that is 10 million records, 1 that is 5 million and 1 that is 4 million. Performance and reliability have never been an issue. In fact, it's the only thing in our stack that we never have issues with. (knock on wood)