duankeye2342
2013-07-31 10:37
浏览 203

MongoDB - 按字符串搜索GridFS文件内容

I am planning to upload user's word documents in MongoDB using GridFS. I have to implement following functionality.

When admin type a string and hit search in administration app, i have to list all word documents where the contents contain the search string. I have to search across all user's documents.

Is there a way to achieve this in MongoDB? If not, what is the best way to achieve this?

图片转代码服务由CSDN问答提供 功能建议

我打算使用GridFS在MongoDB中上传用户的word文档。 我必须实现以下功能。

当管理员输入字符串并在管理应用程序中点击搜索时,我必须列出内容包含搜索字符串的所有word文档。 我必须搜索所有用户的文档。

有没有办法在MongoDB中实现这一目标? 如果没有,实现这一目标的最佳方法是什么?

  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • draj30958 2013-07-31 12:47
    已采纳

    In MongoDB the best you can do is a binary match of your search phrase against the contents in GridFS, but in Word documents you will probably not find this phrase as it's likely compressed.

    I think you would be much better off using a dedicated search solution such as Solr. Solr even allows you to extract text from Word documents and allows you to search for any sort of phrase in a quite complete search language. Have a look at http://wiki.apache.org/solr/ExtractingRequestHandler for dealing with Word documents f.e.

    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题