Search code examples
solrdataimporthandler

Solr Delta Import overwriting other source data


We are trying to feed data into solr through following two ways:

  1. SQL server based table
  2. Generate runtime information for additional columns and update these for key mentioned in 1 through solr Rest-API.

But when full or delta import runs for sql data columns, it removes data stored in additional columns which are not part of sql entity. I have already tried import only for given entity. These additional columns are not part of entity definition in data-config.xml


Solution

  • If I understood your question correctly:
    When you insert a document into Solr/Lucene, the only thing that it looks is the field that you have set as uniqueKey in your schema. If you attempt to add additional attributes to an existing document, Solr will delete the existing document (that has that unique ID) and keep only fields/attributes that you provide in that document that was last inserted into index.

    There is a feature in Solr called partial updates, but it basically reads the current field values (so all fields must be stored) and then re-inserts them as if you provided them. I think that's your best bet.
    Take a look here for more info.