Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mongodb approximate string matching

Tags:

I am trying to implement a search engine for my recipes-website using mongo db. I am trying to display the search suggestions in type-ahead widget box to the users.

I am even trying to support mis-spelled queries(levenshtein distance).

For example: whenever users type 'pza', type-ahead should display 'pizza' as one of the suggestion.

How can I implement such functionality using mongodb?

Please note, the search should be instantaneous, since the search result will be fetched by type-ahead widget. The collections over which I would run search queries have at-most 1 million entries.

I thought of implementing levenshtein distance algorithm, but this would slow down performance, as collection is huge.

I read FTS(Full Text Search) in mongo 2.6 is quite stable now, but my requirement is Approximate match, not FTS. FTS won't return 'pza' for 'pizza'.

Please recommend me the efficient way.

I am using node js mongodb native driver.