Reputation: 4519
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 . 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?
<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?
eg,
SET @USerID = 0;
Thanks .
Upvotes: 0
Views: 563
Reputation: 52822
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). You can use a UNION to solve the first case if two different entities does not work for what you want to do.
Upvotes: 1