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

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

问题描述

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

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?

推荐答案

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

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

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

Mongo 更像是一种通用的可扩展数据存储,但目前它还没有任何全文搜索支持.根据您的用例,您可以将标准 b-tree 索引与文本中所有单词的数组一起使用,但它不会进行词干或模糊匹配等.

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.

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

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.

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

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天全站免登陆