Let me take an example to explain the scenario. Suppose i have data indexed to Solr as :
{
"id" : "872919092",
"filename" : "science_book",
"path" : "/local/abc/"
}
Now i want to modify the data already indexed to Solr with id : 872919092
. I need to change the filename : science_book
with filename : history_book
and add new attribute topic : mughal
to the same indexed data keeping path
unchanged. I do not want to pass the path
again as there is no change in that and already indexed to Solr. According to the documentation of Solr
this is possible. How do i do that using nodejs solr-client update method? I want to achieve the below scene :
- If the attribute does not exist in the Solr indexed data with particular id, add that to the already indexed data keeping the previously indexed data unchanged.
- If the attribute already exists in the Solr indexed data with particular id, change the value of the previously indexed attribute keeping the other indexed data unchanged.
I am passing the data to add in Solr as a hash which is a combination of only the new attributes to be added to already indexed data in Solr and changes in the value of the previously indexed data to Solr.
Note : I am using Solr-4.3.0 and node module solr-client for adding data to Solr.
You will need to add set or add to the field and remove the rest of the fields. You need id and the fields.
Also note that you can increment or decrement int's using inc or dec