reindexing json object into solr by adding only unique elements

心不动则不痛 提交于 2019-12-12 02:25:51

问题


I have indexed json object into solr using httpclient and when I tried to index again, duplicate records are getting indexed.

So how to update the records into solr, everytime I index I want to update the records.

Thanks in advance


回答1:


In your JSON Object include an ID field inside your json object and it should be unique, for example some random number like 65746 . When you will try to index this document again, solr will check for id .If id is same, solr will not index that whole document again . Now the question is how you declare a unique field in solr schema . So for that go to your schema.xml file or managed-schema file which is inside your core configuration and define unique field like this id . Now solr will identify id coming from your JSON as unique , and won't indexed already indexed documents.Hence there will be no duplicate records. Let me know if that helped you :)



来源:https://stackoverflow.com/questions/38090847/reindexing-json-object-into-solr-by-adding-only-unique-elements

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!