1. Solr
  2. SOLR-2907

java.lang.IllegalArgumentException: deltaQuery has no column to resolve to declared primary key pk='ITEM_ID, CATEGORY_ID'



      We are using solr for our site and ran into this error in our own schema and I was able to reproduce it using the dataimport example code in the solr project. We do not get this error in SOLR 1.4 only started seeing it as we are working to upgrade to 3.4.0. It fails when delta-importing linked tables.

      Complete trace:
      Nov 18, 2011 5:21:02 PM org.apache.solr.handler.dataimport.DataImporter doDeltaImport
      SEVERE: Delta Import Failed
      java.lang.IllegalArgumentException: deltaQuery has no column to resolve to declared primary key pk='ITEM_ID, CATEGORY_ID'
      at org.apache.solr.handler.dataimport.DocBuilder.findMatchingPkColumn(
      at org.apache.solr.handler.dataimport.DocBuilder.collectDelta(
      at org.apache.solr.handler.dataimport.DocBuilder.collectDelta(
      at org.apache.solr.handler.dataimport.DocBuilder.doDelta(
      at org.apache.solr.handler.dataimport.DocBuilder.execute(
      at org.apache.solr.handler.dataimport.DataImporter.doDeltaImport(
      at org.apache.solr.handler.dataimport.DataImporter.runCmd(
      at org.apache.solr.handler.dataimport.DataImporter$

      I used this dataConfig from the wiki on the data import:

      <dataSource driver="org.hsqldb.jdbcDriver" url="jdbc:hsqldb:./example-DIH/hsqldb/ex" user="sa" />

      <entity name="item" pk="ID"
      query="select * from item"
      deltaImportQuery="select * from item where ID=='$


      deltaQuery="select id from item where last_modified > '$


      <entity name="item_category" pk="ITEM_ID, CATEGORY_ID"
      query="select CATEGORY_ID from item_category where ITEM_ID='${item.ID}'"
      deltaQuery="select ITEM_ID, CATEGORY_ID from item_category where last_modified > '${dataimporter.last_index_time}

      parentDeltaQuery="select ID from item where ID=$



      <entity name="category" pk="ID"
      query="select DESCRIPTION as cat from category where ID = '$


      deltaQuery="select ID from category where last_modified > '$


      parentDeltaQuery="select ITEM_ID, CATEGORY_ID from item_category where CATEGORY_ID=$




      To reproduce use the data config from above and set the last update times to before the last_modifed date in the example data. I my case I had to set the year to 1969. Then run a delta-import and the exception occurs. Thanks.


        Alan Baker made changes -
        Field Original Value New Value
        Component/s contrib - DataImportHandler [ 12312438 ]
        Alan Baker created issue -


          • Assignee:
            Alan Baker
          • Votes:
            4 Vote for this issue
            12 Start watching this issue


            • Created: