简体   繁体   English

在没有schema.xml的情况下将mongo动态数据添加到solr中

[英]Add mongo dynamic data into solr without schema.xml

I need to Feed some data into the solr , so far i have seen process of feeding data is , Create schema.xml and feed data in particular fields into solr and index it using any client library. 我需要向solr中馈入一些数据,到目前为止,我已经看到馈入数据的过程是,创建schema.xml并将特定字段中的数据馈入solr并使用任何客户端库对其进行索引。

I have some different kind of requirement. 我有一些不同的要求。 I have a MongoCollection , it has many fields , some nested arrays and also some dynamic key-value inside hese array. 我有一个MongoCollection,它具有许多字段,一些嵌套数组以及这些数组中的一些动态键值。

i want to feed exact structure into the solr and also index it , so that when i retrive the data using keyword search , i should be able to get the document in the same structure. 我想将确切的结构输入solr并对其进行索引,以便在使用关键字search检索数据时,我应该能够以相同的结构获取文档。

That all what i need it any how , so first question is , is that kind of stuff is possible with solr or not? 我所需要的一切如何,所以第一个问题是,solr是否可能实现这种工作?

If yes please share some references or any help. 如果是,请分享一些参考或任何帮助。

Thanks in advance. 提前致谢。

Try using "schemaless mode", though it will not give exactly what you asked for. 尝试使用“无缝模式”,尽管它不能完全满足您的要求。 https://cwiki.apache.org/confluence/display/solr/Schemaless+Mode https://cwiki.apache.org/confluence/display/solr/Schema+Factory+Definition+in+SolrConfig https://cwiki.apache.org/confluence/display/solr/Schemaless+Mode https://cwiki.apache.org/confluence/display/solr/Schema+Factory+Definition+in+SolrConfig

You can also look at "nested documents" but you may need to restructure your data before POSTing to Solr. 您还可以查看“嵌套文档”,但是在向SOLr POST之前,可能需要重组数据。 http://yonik.com/solr-nested-objects/ http://yonik.com/solr-nested-objects/

You may want to search in Solr to get a document ID, then use it to retrieve the original document from MongoDB. 您可能需要在Solr中搜索以获取文档ID,然后使用它从MongoDB中检索原始文档。

It depends on your needs. 这取决于您的需求。 Do you realy need to search or filter on every attribute from an mongoDB object? 您是否真的需要搜索或过滤mongoDB对象中的每个属性?

Or do you only need to search an keyword (which is part of the mongoDB document/object) in order to return the original mongoDB document/object, which is mostly an JSON-string? 还是只需要搜索一个关键字(属于mongoDB文档/对象的一部分)才能返回原始的mongoDB文档/对象(主要是JSON字符串)?

If the 2nd case fits, so you could set up your solr with only two fields: one field for the mongoDB-Object ID and one mutlivalue textfield for the mongoDB document. 如果第二种情况适合,那么您可以仅使用两个字段来设置solr:一个字段用于mongoDB-Object ID,另一个字段用于mongoDB文档。

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

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