I'm working on a Solr dataimport
from an Oracle database. The database system has a set of tables dedicated to storing references to changes in other tables.
For example, I might have a table named PERSON
, and when records are added to this table, their IDs are added to the PERSON_CHANGED
table. I'd like to use this PERSON_CHANGED
table when defining my deltaQuery
so that Solr only indexes the changed records in subsequent indexes. As part of this process, I need to remove records that I've read from the PERSON_CHANGED
table after Solr finishes its import (either delta or full), so that I don't process them again later.
What's the best way to run this kind of "cleanup" SQL query after a dataimport
?
I've tried combining both of the queries like this (simplified for brevity):
<dataConfig>
<dataSource ... >
<document>
<entity name="person"
query="
SELECT ID, FIRST_NAME, LAST_NAME
FROM PERSON
WHERE '${dataimporter.request.clean}' != 'false'
OR PERSON_ID IN (
SELECT ID FROM CHANGED_PERSON
);
DELETE * (
SELECT * FROM CHANGED_PERSON
);
" />
</document>
</dataConfig>
But this results in a SQL command not properly ended
error. Does Solr provide a way to do this kind of cleanup?