1 year ago
#296684
Adarsh Goswami
Solr Deduplication (dedupe) is not working, getting error while updating document
I have followed the example listed in the below documentation : https://solr.apache.org/guide/8_4/de-duplication.html
My requirement is to ignore duplicate records, but after implementing dedupe I am not able to add any document(even if it is unique) and getting same error :
Exception in thread "main" org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException: Error from server at http://localhost:8983/solr/my_core: Document contains multiple values for uniqueKey field: id=[0011, affa84b255f98fd800dd0056b7040855] at org.apache.solr.client.solrj.impl.HttpSolrClient.executeMethod(HttpSolrClient.java:681) at org.apache.solr.client.solrj.impl.HttpSolrClient.request(HttpSolrClient.java:266) at org.apache.solr.client.solrj.impl.HttpSolrClient.request(HttpSolrClient.java:248) at org.apache.solr.client.solrj.SolrRequest.process(SolrRequest.java:214) at org.apache.solr.client.solrj.SolrClient.add(SolrClient.java:177) at org.apache.solr.client.solrj.SolrClient.add(SolrClient.java:138) at org.apache.solr.client.solrj.SolrClient.add(SolrClient.java:156)
solrconfig.xml :
<updateRequestProcessorChain name="dedupe">
<processor class="solr.processor.SignatureUpdateProcessorFactory">
<bool name="enabled">true</bool>
<str name="signatureField">id</str>
<str name="fields">first_name,last_name,phone_no</str>
<bool name="overwriteDupes">false</bool>
<str name="signatureClass">solr.processor.TextProfileSignature</str>
</processor>
<processor class="solr.LogUpdateProcessorFactory" />
<processor class="solr.RunUpdateProcessorFactory" />
</updateRequestProcessorChain>
<requestHandler name="/update" class="solr.UpdateRequestHandler" >
<lst name="defaults">
<str name="update.chain">dedupe</str>
</lst>
</requestHandler>
schema.xml :
<?xml version="1.0" encoding="UTF-8" ?>
<schema name="dummydata" version="1.5">
<field name="first_name" type="string" indexed="true" stored="true" multiValued="false" />
<field name="last_name" type="string" indexed="true" stored="true" multiValued="false" />
<field name="location" type="string" indexed="true" stored="true" multiValued="false" />
<field name="phone_no" type="string" indexed="true" stored="true" multiValued="false" />
<field name="id" type="string" indexed="true" stored="true" required="true" multiValued="false" />
<uniqueKey>id</uniqueKey>
</schema>
Java code used :
{
String urlString = "http://localhost:8983/solr/my_core";
SolrClient Solr = new HttpSolrClient.Builder(urlString).build();
UpdateResponse response;
SolrInputDocument myDocumentInstantlycommited = new SolrInputDocument();
myDocumentInstantlycommited.addField("id", "0011");
myDocumentInstantlycommited.addField("first_name", "T11");
myDocumentInstantlycommited.addField("last_name","L11");
myDocumentInstantlycommited.addField("phone_no","9912121312");
myDocumentInstantlycommited.addField("location","TESt211");
response=Solr.add( myDocumentInstantlycommited);
Solr.commit();
Solr.close();
System.out.println("Documents Updated");
}
solr
solrj
0 Answers
Your Answer