As it turns out, the code snippet shown above in the question actually works. I don’t know what was wrong the first time I tried it, perhaps I simply forgot to commit or my schema was misconfigured.
In any case, this question is very localized. However, since the api with the hash map is so poorly documented, I thought maybe it is worth to keep this question and answer.
The key of the hash map can be one of three values:
- set – to set a field.
- add – to add to a multi-valued field.
- inc – to increment a field.
There is an example of this code in the solrj unit tests, in a method called testUpdateField
.