On 8/10/2011 2:52 PM, Eugeny Balakhonov wrote:
java.lang.IllegalArgumentException: deltaQuery has no column to resolve to
declared primary key pk='T1_ID_RECORD, T2_ID_RECORD'

I have analyzed the source code of DIH. I found that in the DocBuilder class
collectDelta() method works with value of entity attribute "pk" as with
simple string. But in my case this is array with two values: T1_ID_RECORD,
T2_ID_RECORD

Whatever you declare as the DIH primary key must exist as a field name in the result set, or Solr will complain. I had a perfectly working config in 1.4.1, with identical text in query and deltaImportQuery. It didn't work when I tried to upgrade to 3.1. The problem was that I was using a deltaQuery that just returned MAX(did), to tell Solr that something needed to be done. I had to add "AS did" to the deltaQuery so that it matched my primary key. I am controlling the delta-import from outside Solr, so I do not need to use the result set from deltaQuery.

The point is to pick something that will exist in all of your result sets. You might need to include an "AS xxx" (with something you choose for xxx) in your queries and use the xxx value as your pk. Because you have only provided a simple example, I can't really tell you what you should use.

The pk value is only used to coordinate your queries. It only has meaning in the DIH, not the Solr index. Uniqueness in the Solr index is controlled by the uniqueKey value in schema.xml. In my case, pk and uniqueKey are not the same field.

Side note: I'm not much of an expert, so I can't guarantee I can help further. I will give it a try, though.

Thanks,
Shawn

Reply via email to