简体   繁体   English

SOLR DIH在同一个MySql表上添加具有多个查询的文档

[英]SOLR DIH Adding document with multiple queries on same MySql table

I am Kind of Noob in Solr, Iam stucked in a Situation where I want to Make a full import to a Same Document entity, using multiple queries on SAME Table based on diffrent conditions using Solr DIH . 我是Solr中的Noob,我困在一种情况下,我想使用基于Solr DIH的不同条件,对SAME表使用多个查询,以完全导入同一文档实体。 So it can be achieved ? 这样可以实现吗?

My Problem (What I want to Do) : 我的问题(我想做什么):

Say for eg , I want to define my data import schema like this , to Index entity with the data from TABLE A , Multiple Times based on different conditions , is the below format possible? 比如说,我想像这样定义我的数据导入模式,以基于不同条件多次使用来自TABLE A的数据索引实体,以下格式是否可能?

   <entity name="ITEM" query="select * from TABLE A where condition 1  And Some different sets of rules">
       <field column="ID" name="id" />
       <field column="NAME" name="name" />
       <field column="MANU" name="manu" />
       <field column="WEIGHT" name="weight" />
       <field column="PRICE" name="price" />
       <field column="POPULARITY" name="popularity" />
       <field column="INSTOCK" name="inStock" />
       <field column="INCLUDES" name="includes" />
   </entity>

   <entity name="ITEM" query="select * from TABLE A where condition 2  And Some different sets of rules">
       <field column="ID" name="id" />
       <field column="NAME" name="name" />
       <field column="MANU" name="manu" />
       <field column="WEIGHT" name="weight" />
       <field column="PRICE" name="price" />
       <field column="POPULARITY" name="popularity" />
       <field column="INSTOCK" name="inStock" />
       <field column="INCLUDES" name="includes" />
   </entity>

On more Question : How to SET MYSql custom variables in SOLR Data Import config file? 更多问题:如何在SOLR数据导入配置文件中设置MYSql自定义variables

eg, 例如,

SET @USerID = 0;

Thanks . 谢谢 。

Defining several entities with different queries that import into the same collections should work as you write. 在编写时,可以使用导入到相同集合中的具有不同查询的多个实体进行定义。 You probably want different name=""-s for them, though (if you have to ask "Does this work?", just try it). 不过,您可能希望为它们使用不同的name =“-s(如果您必须询问“这是否有用吗?”,只需尝试一下)。 You can use a UNION to solve the first case if two different entities does not work for what you want to do. 如果两个不同的实体不能满足您的要求,则可以使用UNION解决第一种情况。

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

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