WebFaction
Community site: login faq

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.

asked 05 Jul '14, 09:13

mab
1113
accept rate: 0%

edited 05 Jul '14, 09:15


You might consider posting your question on the official Solr mailing list or asking their IRC channel. Their user community would have more info about this level of configuration and schema management.

permanent link

answered 05 Jul '14, 21:24

johns
5.4k412
accept rate: 23%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×3

question asked: 05 Jul '14, 09:13

question was seen: 3,540 times

last updated: 05 Jul '14, 21:24

                              
WEBFACTION
REACH US
SUPPORT
LEGAL
© COPYRIGHT 2003-2021 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM