While checking this, I encountered a bug in master. Since you have
mentioned that it works in Solr 8, the bug might be unrelated to your issue.
I have raised a ticket to track this
https://issues.apache.org/jira/browse/SOLR-14550 to track the bug
Regards,
Munendra S N
On Mon, Jun 8, 2020 at 9:11 PM Thomas Corthals <tho...@klascement.net>
wrote:
> Hi
>
> I'm trying to do atomic updates with an 'add-distinct' modifier in a Solr 7
> cloud. It seems to behave like an 'add' and I end up with double values in
> my multiValued field. This only happens with multiple values for the field
> in an update (cat:{"add-distinct":["a","b","d"]} exhibits this
> problem, cat:{"add-distinct":"a"} doesn't). When running the same update
> request with a single core, or a Solr 8 cloud, I get the expected result.
>
> This is a minimal test case with Solr 7.7.3 in cloud mode, 2 nodes, a
> collection with shard count 1 and replicationFactor 2, using the
> techproducts configset.
>
> $ curl -X POST -H 'Content-Type: text/json' '
> http://localhost:8983/solr/techproducts/update?commit=true' --data-binary
> '[{"id":123,cat:["a","b","c"]}]'
> {
> "responseHeader":{
> "rf":2,
> "status":0,
> "QTime":75}}
>
> $ curl -X POST -H 'Content-Type: text/json' '
> http://localhost:8983/solr/techproducts/update?commit=true' --data-binary
> '[{"id":123,cat:{"add-distinct":["a","b","d"]}}]'
> {
> "responseHeader":{
> "rf":2,
> "status":0,
> "QTime":81}}
>
> $ curl '
> http://localhost:8983/solr/techproducts/select?q=id%3A123&omitHeader=true'
> {
> "response":{"numFound":1,"start":0,"docs":[
> {
> "id":"123",
> "cat":["a",
> "b",
> "c",
> "a",
> "b",
> "d"],
> "_version_":1668919799351083008}]
> }}
>
> Is this a known issue or am I missing something here?
>
> Kind regards
>
> Thomas Corthals
>