Peter,

See http://wiki.apache.org/solr/DataImportHandler#Using_delta-import_command , 
then scroll down to where it says "The deltaQuery in the above example only 
detects changes in item but not in other tables..."  It shows you two ways to 
do it.

Option 1:  add a reference to the last_modified_date (or whatever) from the 
child table in a "where-in" clause in the parent entity's "deltaQuery".

Option 2:  add a "parentDeltaQuery" on the child entity.  This is a query that 
tells DIH which parent-table keys need to update because of child table 
updates.  In other words, say your child's Delta Query says that child_id=1 
changed.  You might have for parentDeltaQuery something like: SELECT ID FROM 
PARENT P WHERE P.CHILD_ID=${Child.ID} .  While this can simplify things for you 
and prevent you from not needing giant "where-in" clauses on the parent query, 
it will double the number of queries that get issued to determine which 
documents to update.

James Dyer
E-Commerce Systems
Ingram Content Group
(615) 213-4311


-----Original Message-----
From: PeterKerk [mailto:vettepa...@hotmail.com] 
Sent: Friday, January 11, 2013 12:02 PM
To: solr-user@lucene.apache.org
Subject: how to perform a delta-import when related table is updated

My delta-import
(http://localhost:8983/solr/freemedia/dataimport?command=delta-import) does
not correctly update my solr fields.


Please see my data-config here:
        <entity name="freemedia" query="select * from freemedia WHERE
categoryid>0"
                deltaImportQuery="select * from freemedia WHERE updatedate &lt; 
getdate()
AND id='${dataimporter.delta.id}' AND categoryid>0"
                deltaQuery="select id from freemedia where updatedate &gt;
'${dataimporter.last_index_time}' AND categoryid>0">            

                
         <entity name="lovecount" query="select COUNT(id) as likes FROM
freemedialikes WHERE freemediaid=${freemedia.id}"></entity>                     
        

Now when a new item is inserted into [freemedialikes]
and I perform a delta-import, the Solr index does not show the total new
amount of likes. Only after I perform a full-import
(http://localhost:8983/solr/freemedia/dataimport?command=full-import) the
correct number is shown.
So the SQL is returning the correct results, I just don't know how to get
the updated likes count via the delta-import.

I have reloaded the data-config everytime I made a change. 



--
View this message in context: 
http://lucene.472066.n3.nabble.com/how-to-perform-a-delta-import-when-related-table-is-updated-tp4032587.html
Sent from the Solr - User mailing list archive at Nabble.com.


Reply via email to