MongoDB doesn't have full text search (that is decently fast). Thus, I have to match strings by the beginning of a word. Thus, if a user types in over, overflow will match, but stackoverflow will not.

My question is: is it detrimental to the user experience if we only match the beginning of a word? Do you as a user expect these results in a search query? Full text search queries work for most sites I've used. A use case scenario:

Suppose I'm searching for a friend name Elizabeth Banks, but she only goes by liz, so I type is liz, but that won't match at all.

Also, the order of the words do not matter as I plan to split the phrase into keywords. For example, if I have a user name Elizabeth Banks, I will store the keywords elizabeth and banks in user.keywords. Now when I search for "elizabeth banks", I will search through users where user.keywords has a match for both /^elizabeth/ and /^banks/.

MongoDB Reference: http://www.mongodb.org/display/DOCS/Full+Text+Search+in+Mongo

  • thanks guys. i think i'm just going to go with a search index since there are so many issues with using MongoDB only. Sep 30, 2012 at 0:04

2 Answers 2


I think it depends on why users might be searching on your site. People these days have strong expectations of full-text search that matches words. Getting false-positives (e.g., overflow for over) might be confusing if it happens too frequently.

Have you considered adding a real full-text index using lucene, solr, or some such?

  • yes. i just don't know if it's worth implementing for v1. i guess what the solution for overflow for over is that results should be weighted by the % of the word matched, ie higher relevance for overflo vs overflow. Pretty sure I'd need a real search index in that case. Sep 29, 2012 at 23:27
  • The other thing you'll need to worry about a bit is if the query includes multiple terms, you should consider how to rank retrieved documents. Search engines devote considerable attention to this ranking function for good reason: simply finding all documents with matching terms may not be enough to surface the good matches. Sep 30, 2012 at 0:36
  • 1
    yep. decided on just going with elasticsearch. Sep 30, 2012 at 5:26
  • elastic search should be particularly appropriate if you have rapidly evolving data. Sep 30, 2012 at 5:36

Search and automation is always an interesting topic. There are a number of things to consider designing search auto fill, such as – do you want to match the beginning of a word, or part of a word? Do you have a controlled library of things to search from or are we talking about free text search? How about spelling errors – should we handle them or not? Do we want to give instant results to our search – or just the presumed correct search term leading to a search result page?


Auto-complete works best in conjunction to a controlled vocabulary, such as names, locations, e-mail addresses and the like. If it is names, we should consider first names and last names just as valid. The user might recall the first name or the last name. Showing results on auto-complete for both first names and last names make the most sense to the user.


Auto-suggest on the other hand is very close related to auto-complete, but the goal is to help the user in different ways, such as suggesting the correct spelling, related search terms (from a taxonomy), frequent searches and more. It is harder to implement, but is the one who helps the user most. In this case it’s hard to have a wider search (if you have a lot of content) who would match within a string. Better yet to suggest spelling corrections – and the user will be helped in a better way. I would suggest (!) that you use the entered string from the beginning of words and not within words.

Google auto suggest

Instant results

The third option you have is to implement instant result, and skip the search result page completely. This technique is implemented on Apple.com and on Windows 7 and Windows 8 search capabilities. You get groups of possible items such as programs, documents and settings in return.

Windows 8 Instant Search Result

More to read: Designing Search (part 2): As-you-type suggestions

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.