在MongoDB GridFS上进行全文搜索? [英] Full-text search on MongoDB GridFS?

查看:138
本文介绍了在MongoDB GridFS上进行全文搜索?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假如我想使用MongoDB的GridFS存储PDF或ePub文件,是否可以对数据文件执行全文搜索?

解析方案

目前您无法在mongo中进行真正的全文搜索: http://www.mongodb.org/display/DOCS/Full+Text+Search+in+Mongo



随意在这里投票:
https://jira.mongodb.org/browse/SERVER- 380



Mongo更多的是一种通用的可扩展数据存储,至今还没有任何全文搜索支持。根据您的使用情况,您可以使用标准b-tree索引以及文本中所有单词的数组,但不会进行词干或模糊匹配等。



但是,我建议将mongodb与基于lucene的应用程序(弹性搜索很流行)相结合。您可以将所有数据存储在mongodb(二进制数据,元数据等)中,然后使用lucene将文档的纯文本索引。或者,如果您的用例是纯全文搜索,您可以考虑使用弹性搜索而不是mongodb。



更新(2013年4月):
MongoDB 2.4现在支持基本的全文索引!以下是一些有用的资源。



http://docs.mongodb.org/manual/applications/text-search/

http://docs.mongodb.org/manual/reference/command/text/#dbcmd.text



http://blog.mongohq.com/blog/2013/01/22/first-week-with-mongodb-2-dot-4-development-release/

Say, if I want to store PDFs or ePub files using MongoDB's GridFS, is it possible to perform full-text searching on the data files?

解决方案

You can't currently do real full text search within mongo: http://www.mongodb.org/display/DOCS/Full+Text+Search+in+Mongo

Feel free to vote for it here: https://jira.mongodb.org/browse/SERVER-380

Mongo is more of a general purpose scalable data store, and as of yet it doesn't have any full text search support. Depending on your use case, you could use the standard b-tree indexes with an array of all of the words in the text, but it won't do stemming or fuzzy matches, etc.

However, I would recommend combining mongodb with a lucene-based application (elastic search is popular). You can store all of your data in mongodb (binary data, metadata, etc.), and then index the plain text of your documents in lucene. Or, if your use case is pure full text search, you might consider just using elastic search instead of mongodb.

Update (April 2013): MongoDB 2.4 now supports a basic full-text index! Some useful resources below.

http://docs.mongodb.org/manual/applications/text-search/

http://docs.mongodb.org/manual/reference/command/text/#dbcmd.text

http://blog.mongohq.com/blog/2013/01/22/first-week-with-mongodb-2-dot-4-development-release/

这篇关于在MongoDB GridFS上进行全文搜索?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆