I have 8 tables in my solr data-config files and all are joined since i
need data from all of them.
But out of those 8 tables i have three tables that have common fields
,which i can use to link.But the issues is that the common fields in the
three table that i have are such that they are repeating values.
eg:-
First table(businessmasters) has 2 columns
Business_id(pk) Business_name Mod1(on update timestamp)
1 ABC
2 XYZ
3 KOT
Second table(search_tag) has 3 columns
Search_tag_id(pk) Business_id Search_tag_name Mod2(on update timestamp)
1 1 hair
2 1 trimming
3 2 massage
4 1 facial
5 2 makeup
Now i want to join the two tables and i do that on the basis of
Business_id.But since iam joining on Business_id which is a non key in
second table i just write that business_id is a key(because if i cant use
Search_tag_id as its not common in both tables and if i take Search_tag_id
as pk and join the tables on Business_id solr gives an error during delta
import
"deltaQuery has no column to resolve to declared primary key").
But when i say that Business_id is pk and join tables on the basis of that
it works fine and delta import works.
But the issue comes when i try to change the Business_id in second table
eg i want to change the Business_id of Search_tag_id 3 to 1 and i run
delta import.The update adds the search tag to Business_id 1 but also
doesn't remove the search tag from Business_ID 2.The value of search tags
in Business_id 2 remains there ,where as it should go away if iam changing
Business_id from 2 to 1.Since now Business_id is not linked to any search
tag.
Iam not able to figure out how to resolve this issue.This is how i write it
in data-config file.
<entity name="businessmasters" pk="business_id" query="SELECT Business_id,
Business_name,Mod1 from businessmasters"
deltaImportQuery="SELECT Business_id,
Business_name,Mod1 from businessmasters where
business_id='${dih.delta.business_id}"
deltaQuery="select business_id from businessmasters where modified >
'${dih.last_index_time}'">
<field column="business_id" name="id"/>
<field column="business_name" name="business_name" indexed="true"
stored="true" />
<field column="Mod1" name="Mod1" indexed="true" stored="true" />
<entity name="search_tag" pk="business_id" query="SELECT
Search_tag_id,Search_tag_name from search_tag where
business_id='${businessmasters.business_id}'"
deltaQuery="select business_id from search_tag where Mod2 >
'${dih.last_index_time}'"
parentDeltaQuery="select business_id from businessmasters where
business_id=${search_tag.business_id}">
<field column="business_id " name="id" />
<field column="Search_tag_id" name="Search_tag_id" indexed="true"
stored="true" />
<field column="Search_tag_name " name="Search_tag_name " indexed="true"
stored="true" />
<field column="Mod2" name="Mod2" indexed="true" stored="true" />
</entity>
</entity>
Thanks in advance iam new to solr and iam stuck on this issue.
need data from all of them.
But out of those 8 tables i have three tables that have common fields
,which i can use to link.But the issues is that the common fields in the
three table that i have are such that they are repeating values.
eg:-
First table(businessmasters) has 2 columns
Business_id(pk) Business_name Mod1(on update timestamp)
1 ABC
2 XYZ
3 KOT
Second table(search_tag) has 3 columns
Search_tag_id(pk) Business_id Search_tag_name Mod2(on update timestamp)
1 1 hair
2 1 trimming
3 2 massage
4 1 facial
5 2 makeup
Now i want to join the two tables and i do that on the basis of
Business_id.But since iam joining on Business_id which is a non key in
second table i just write that business_id is a key(because if i cant use
Search_tag_id as its not common in both tables and if i take Search_tag_id
as pk and join the tables on Business_id solr gives an error during delta
import
"deltaQuery has no column to resolve to declared primary key").
But when i say that Business_id is pk and join tables on the basis of that
it works fine and delta import works.
But the issue comes when i try to change the Business_id in second table
eg i want to change the Business_id of Search_tag_id 3 to 1 and i run
delta import.The update adds the search tag to Business_id 1 but also
doesn't remove the search tag from Business_ID 2.The value of search tags
in Business_id 2 remains there ,where as it should go away if iam changing
Business_id from 2 to 1.Since now Business_id is not linked to any search
tag.
Iam not able to figure out how to resolve this issue.This is how i write it
in data-config file.
<entity name="businessmasters" pk="business_id" query="SELECT Business_id,
Business_name,Mod1 from businessmasters"
deltaImportQuery="SELECT Business_id,
Business_name,Mod1 from businessmasters where
business_id='${dih.delta.business_id}"
deltaQuery="select business_id from businessmasters where modified >
'${dih.last_index_time}'">
<field column="business_id" name="id"/>
<field column="business_name" name="business_name" indexed="true"
stored="true" />
<field column="Mod1" name="Mod1" indexed="true" stored="true" />
<entity name="search_tag" pk="business_id" query="SELECT
Search_tag_id,Search_tag_name from search_tag where
business_id='${businessmasters.business_id}'"
deltaQuery="select business_id from search_tag where Mod2 >
'${dih.last_index_time}'"
parentDeltaQuery="select business_id from businessmasters where
business_id=${search_tag.business_id}">
<field column="business_id " name="id" />
<field column="Search_tag_id" name="Search_tag_id" indexed="true"
stored="true" />
<field column="Search_tag_name " name="Search_tag_name " indexed="true"
stored="true" />
<field column="Mod2" name="Mod2" indexed="true" stored="true" />
</entity>
</entity>
Thanks in advance iam new to solr and iam stuck on this issue.