简体   繁体   English

使用MongoDB在Grails应用程序上运行基于Lucene的搜索

[英]Running Lucene-based search on Grails application using MongoDB

Currently I am investigating in ways to implement a Lucene-based search on a Grails application using MongoDB. 目前,我正在研究如何使用MongoDB在Grails应用程序上实现基于Lucene的搜索。

Requirements include the following: 要求包括以下内容:

  • The data to index is stored in a MongoDB 要索引的数据存储在MongoDB中
  • Data only gets inserted (no updates, no deletions) 仅插入数据(无更新,无删除)
  • The application has to run on the CloudBees platform 该应用程序必须在CloudBees平台上运行
  • The search should be implemented without any external services like Searchly or WebSolr 搜索应该在没有任何外部服务(如Searchly或WebSolr)的情况下实现

So far this does not seem to be very complicated as there are Grails plugins. 到目前为止,这似乎并不是非常复杂,因为有Grails插件。 However, the main problem I am facing is that my application uses dynamic MongoDB collections. 但是,我面临的主要问题是我的应用程序使用动态 MongoDB集合。 So I do not have a domain class for each and every collection. 所以我没有为每个集合都有一个域类。 Instead, the collections that should be indexed can have arbitrary names and schemas. 相反,应该编制索引的集合可以具有任意名称和模式。 As a result I cannot use Grails plugins like searchable as these seem to only work on fixed domain classes (or am I wrong about that?). 因此,我不能使用像搜索这样的Grails插件,因为这些插件似乎只适用于固定域类(或者我错了吗?)。

Does anybody have experience on how to implement a search in such a context? 有没有人有过如何在这样的环境中实现搜索的经验? Any tips, links, hints, or recommendations? 任何提示,链接,提示或建议?

You can use one index and multiple types for your dynamic MongoDB collections. 您可以为动态MongoDB集合使用一个索引和多个类型。 However that logic should be coded by yourself since integration modules done within a mind set of domain model indexing. 但是,由于集成模块是在域模型索引的思维集中完成的,因此该逻辑应该由您自己编码。

For ElasticSearch you can use Jest via groovy for ElasticSearch https://github.com/searchbox-io/Jest 对于ElasticSearch,您可以使用Jest via groovy for ElasticSearch https://github.com/searchbox-io/Jest

Searchly offers MongoDB integration out of the box unfortunately for a single collection. 不幸的是,Searchly为单个集合提供了开箱即用的MongoDB集成。 therefore for now you also need to query MongoDB(the collection you have created dynamically), index the data to index under new type and query it. 因此,现在您还需要查询MongoDB(您动态创建的集合),将数据索引到新类型下的索引并查询它。

my old post is deleted due to not being related answer, well it is OK :) 由于没有相关的答案,我的旧帖子被删除了,好吧:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM