[ 
https://issues.apache.org/jira/browse/SOLR-11267?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16372507#comment-16372507
 ] 

Amrit Sarkar edited comment on SOLR-11267 at 2/22/18 7:14 AM:
--------------------------------------------------------------

examples on how to use {{add-distinct}}:

pass as list:
{code}
{"id":"mydoc",
 "price":{"set":99},
 "popularity":{"inc":20},
 "categories":{"add":["toys","games"]},
 "sub_categories":{"add-distinct":["children games","PG games"]},
 "promo_ids":{"remove":"a123x"},
 "tags":{"remove":["free_to_try","on_sale"]}
}
{code}
pass as singleton value:
{code}
{"id":"mydoc",
 "sub_categories":{"add-distinct":"V games"}
}
{code}


was (Author: [email protected]):
examples on how to use {{add-distinct}}:

pass as list:
{code}
{"id":"mydoc",
 "price":{"set":99},
 "popularity":{"inc":20},
 "categories":{"add":["toys","games"]},
 "sub_categories":{"add-distinct":["children games","PG games"]},
 "promo_ids":{"remove":"a123x"},
 "tags":{"remove":["free_to_try","on_sale"]}
}

pass as singleton value:
{code}
{code}
{"id":"mydoc",
 "sub_categories":{"add-distinct":"V games"}
}
{code}

> Add support for "add-distinct" atomic update operation
> ------------------------------------------------------
>
>                 Key: SOLR-11267
>                 URL: https://issues.apache.org/jira/browse/SOLR-11267
>             Project: Solr
>          Issue Type: New Feature
>      Security Level: Public(Default Security Level. Issues are Public) 
>            Reporter: Ishan Chattopadhyaya
>            Assignee: Ishan Chattopadhyaya
>            Priority: Major
>         Attachments: SOLR-11267.patch, SOLR-11267.patch
>
>
> Often, a multivalued field is used as a set of values. Since multivalued 
> fields are more like lists than sets, users do two consecutive operations, 
> remove and add, to insert an element into the field and also maintain the 
> set's property of only having unique elements.
> Proposing a new single operation, called "add-distinct" (which essentially 
> means "add-if-doesn't exist") for this.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to