Fuzzy/Partial Search in MongoDB
2016-12-25 08:16
302 查看
http://stackoverflow.com/a/27984038/2177408
The text search feature in MongoDB (as at 2.6) does not have any built-in
features for fuzzy/partial string matching. As you've noted, the use case currently focuses on language & stemming support with basic boolean operators and word/phrase matching.
There are several possible approaches to consider for fuzzy matching depending on your requirements and how you want to qualify "efficient" (speed, storage, developer time, infrastructure required, etc):
Implement support for fuzzy/partial matching in your application logic using some of the readily available soundalike and similarity algorithms. Benefits of this approach include not having to add any extra infrastructure and being able to closely tune matching
to your requirements.
For some more detailed examples, see: Efficient Techniques
for Fuzzy and Partial matching in MongoDB.
Integrate with an external search tool that provides more advanced search features. This adds some complexity to your deployment and is likely overkill just for typeahead, but you may find other search features you would like to incorporate elsewhere in your
application (e.g. "like this", word proximity, faceted search, ..).
For example see: How to Perform Fuzzy-Matching with
Mongo Connector and Elastic Search. Note: ElasticSearch's fuzzy
query is based on Levenshtein distance.
Use an autocomplete library like Twitter's open source
which includes a suggestion engine and query/caching API. Typeahead is actually complementary to any of the other backend approaches, and its (optional) suggestion engine Bloodhound supports
prefetching as well as caching data in local storage.
The text search feature in MongoDB (as at 2.6) does not have any built-in
features for fuzzy/partial string matching. As you've noted, the use case currently focuses on language & stemming support with basic boolean operators and word/phrase matching.
There are several possible approaches to consider for fuzzy matching depending on your requirements and how you want to qualify "efficient" (speed, storage, developer time, infrastructure required, etc):
Implement support for fuzzy/partial matching in your application logic using some of the readily available soundalike and similarity algorithms. Benefits of this approach include not having to add any extra infrastructure and being able to closely tune matching
to your requirements.
For some more detailed examples, see: Efficient Techniques
for Fuzzy and Partial matching in MongoDB.
Integrate with an external search tool that provides more advanced search features. This adds some complexity to your deployment and is likely overkill just for typeahead, but you may find other search features you would like to incorporate elsewhere in your
application (e.g. "like this", word proximity, faceted search, ..).
For example see: How to Perform Fuzzy-Matching with
Mongo Connector and Elastic Search. Note: ElasticSearch's fuzzy
query is based on Levenshtein distance.
Use an autocomplete library like Twitter's open source
typeahead.js,
which includes a suggestion engine and query/caching API. Typeahead is actually complementary to any of the other backend approaches, and its (optional) suggestion engine Bloodhound supports
prefetching as well as caching data in local storage.
相关文章推荐
- fuzzy search add-in for excel
- elasticsearch---search in depth之Partial matching
- LeetCode--search-in-rotated-sorted-array-ii
- leetcode-33. Search in Rotated Sorted Array
- [leetcode 81] Search in Rotated Sorted Array II
- LeetCode刷题笔录Search in Rotated Sorted Array
- 33. Search in Rotated Sorted Array
- Elasticsearch技术解析与实战(七)Elasticsearch partial update
- 【LeetCode】-Search in Rotated Sorted Array II
- Search in Rotated Sorted Array II
- 每日一命令(14)find (search for files in a directory hierarchy)
- Search in rotated array two
- LeetCode之Search in Rotated Sorted Array II
- Deep Image Retrieval: Learning global representations for image search. In ECCV, 2016.
- 【paper】KDD15 - Interpreting Advertiser Intent in Sponsored Search
- Search in Rotated Sorted Array
- [LeetCode#81]Search in Rotated Sorted Array II
- leetcode@ [33] Search in Rotated Sorted Array
- 33 Search in Rotated Sorted Array
- search-in-a-big-sorted-array