Missing mandatory unique key field error in SolrJ

后端 未结 1 1836
悲哀的现实
悲哀的现实 2021-01-26 04:05

I\'ve this issue in my project. I read my .xlsx excel file using Apache Poi and I want to index them in my Solr core. I use SolrInputDocument to index reading file. Here is my j

1条回答
  •  春和景丽
    2021-01-26 04:21

    You probably have in your schema a field set as the unique key like this:

    id
    

    The problem is that when you upload a doc, in this case via Apache POI, you are not sending a value for that unique field.

    You have a couple options:

    1. If you do have a field that will be unique, use it. For example, with a copyField option like:
    
    
    1. As you have the actual document, you could just add a UUID to the "id" field.

    2. Create a unique field like a UUID updating your RequestHandlder, like this:

    
        
          id
        
        ...
    
    ...    
    
        
            uuid
        
    
    

    You also need to update the extract handler:

     
    
      ...
      uuid
    
    

    0 讨论(0)
提交回复
热议问题