(ARTICLE) How to speed up querying for autocomplete field with MongoDB

1,000 views
Skip to first unread message

Damjan Rems

unread,
Nov 25, 2015, 3:05:19 AM11/25/15
to mongodb-user
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

If this group is not the right place for announcement please suggest the right one.

by
TheR

Stephen Steneker

unread,
Nov 25, 2015, 5:28:36 PM11/25/15
to mongodb-user

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

Reply all
Reply to author
Forward
0 new messages