Using atomic updates in Solr
Atomic updates in Solr support the following sets of modifiers:
set
: This modifier sets or replaces a particular indexed field valueadd
: This modifier inserts an additional value into the multi-valued fieldsinc
: This modifier increments a numeric value
Let's see how we can update our index documents using atomic updates. To do this, we'll use the musicCatalog
commit core that we've created in this chapter.
Let's index a new music album with some wrong values, which we will later update using the atomic update feature:
$ curl http://localhost:8983/solr/musicCatalog-commit/update -H "Content-Type: text/xml" --data-binary @sampleAlbumData4.xml <?xml version="1.0" encoding="UTF-8"?> <response> <lst name="responseHeader"><int name="status">0</int><int name="QTime">134</int></lst> </response>
We can navigate to the Solr query browser and search for the indexed data. The following figure shows the indexed data data...