On Wednesday, 25 November 2015 19:05:19 UTC+11, Damjan Rems wrote:
This is an article which I have written about my experience with autocomplete field on 200000 documents collection. http://www.drgcms.org/blog/Damjan%20Rems/how-to-speed-up-querying-for-autocomplete-fields-with-mongodb-2015-11-24
Hi Damjan,
Thanks for sharing! We have a similar approach documented in Model Data to Support Keyword Search. As you’ve noted, regex searches should be case-sensitive and left-anchored to take advantage of indexes.
You might be able to further improve this with client-side smarts/caching (for example, waiting until a certain number of characters have been entered or triggering the autocomplete lookup after a short delay). Typeahead.js is a commonly used JS library which provides both a suggestion engine (Bloodhound) and a UI view (Typeahead).
Regards,
Stephen