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

Yonik Seeley commented on SOLR-3862:
------------------------------------

bq. Yonik, Are you looking at the older patch? 
https://issues.apache.org/jira/secure/attachment/12637687/SOLR-3862.patch is my 
latest patch where I got rid of the regular expression usage.

Heh.  This is exactly what I'm talking about.  It can be hard to reconstruct 
the current state of the API by going through all of the previous comments, or 
by reading a patch - both take unnecessary time/work and are error prone.

This is the current API (in JSON) currently being proposed:
{code}
A field like so will remove all values that match the given value "Cyberpunk":
 "cat"  : {"remove":"Cyberpunk"}
Multiple values can be specified for removal:
 "numbers"  : {"remove":[3,7]}
If the original field contained [8,3,3,5,7,1] then the remove specified above 
will result in [8,5,1]

It's not an error if no values are actually removed or if the field does not 
exist.

Full command example:
curl http://localhost:8983/solr/update -H 'Content-type:application/json' -d '
[
 {"id"    : "book1",
  "cat"   : {"remove":"Cyberpunk"}
 }
]'
{code}

FWIW, I'm fine with this latest API.

> add "remove" as update option for atomically removing a value from a 
> multivalued field
> --------------------------------------------------------------------------------------
>
>                 Key: SOLR-3862
>                 URL: https://issues.apache.org/jira/browse/SOLR-3862
>             Project: Solr
>          Issue Type: Improvement
>          Components: SolrCloud
>    Affects Versions: 4.0-BETA
>            Reporter: Jim Musil
>            Assignee: Erick Erickson
>         Attachments: SOLR-3862-2.patch, SOLR-3862-3.patch, SOLR-3862-4.patch, 
> SOLR-3862.patch, SOLR-3862.patch
>
>
> Currently you can atomically "add" a value to a multivalued field. It would 
> be useful to be able to "remove" a value from a multivalued field. 
> When you "set" a multivalued field to null, it destroys all values.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

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

Reply via email to