lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yonik Seeley (JIRA)" <>
Subject [jira] [Commented] (SOLR-3862) add "remove" as update option for atomically removing a value from a multivalued field
Date Sun, 30 Mar 2014 13:01:19 GMT


Yonik Seeley commented on SOLR-3862:

bq. Could you please let me know where to update the API documentation and I will do that?

Updating actual documentation wouldn't be appropriate since nothing has been committed yet.

My API comment was because Erick indicated he was going to commit a patch, but I couldn't
tell what the intent of the patch was.  It's hard to review a patch when you don't know what
the patch is trying to do.  I took a quick look at the code, and was confused by seeing regular
expressions, and apparently two commands: "replace" and "remove".

For something like this, implementation is easy to fix later, interface is much less so. 
So lets take a minute to talk about what interface we want, and give examples.

Example of interface as I understand it (in JSON).  It's just like the other "atomic update"
field modifiers:
A field like so will add a value (this is existing functionality):
 "cat"  : {"add":"Cyberpunk"}
A field like so will remove all values that match the given pattern "Cyberpunk" (this patch
 "cat"  : {"remove":"Cyberpunk"}
Note that the specified value is a regular expression, so the following will remove all values
starting with "Cyber"
 "cat"  : {"remove":"Cyber.*"}
The regular expression must match the whole value for that value to be removed.

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

 - Do we want a way to specify the removal of multiple values?  
  Perhaps "remove" : [ "A","B","C" ]
 - What are the downsides to using regex?  Someone may not realize that the values being used
are regular expressions until they are in production and values that accidentally have wildcards
in them are used?  Or they may simply forget to do wildcard escaping code since everything
would "just work" until they did encounter them?
 - Perhaps we want a separate way to specify "value" vs "regex".  I assume "value" will  be
a much more common usecase than regex (although I do like the power that regex brings).

> add "remove" as update option for atomically removing a value from a multivalued field
> --------------------------------------------------------------------------------------
>                 Key: SOLR-3862
>                 URL:
>             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,
> 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

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message