Return-Path: X-Original-To: apmail-lucene-dev-archive@www.apache.org Delivered-To: apmail-lucene-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2CCE711771 for ; Mon, 22 Sep 2014 12:00:36 +0000 (UTC) Received: (qmail 69977 invoked by uid 500); 22 Sep 2014 12:00:35 -0000 Delivered-To: apmail-lucene-dev-archive@lucene.apache.org Received: (qmail 69891 invoked by uid 500); 22 Sep 2014 12:00:35 -0000 Mailing-List: contact dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@lucene.apache.org Delivered-To: mailing list dev@lucene.apache.org Received: (qmail 69880 invoked by uid 99); 22 Sep 2014 12:00:35 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 22 Sep 2014 12:00:35 +0000 Date: Mon, 22 Sep 2014 12:00:35 +0000 (UTC) From: "Anurag Sharma (JIRA)" To: dev@lucene.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Comment Edited] (SOLR-6307) Atomic update remove does not work for int array or date array MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/SOLR-6307?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14143130#comment-14143130 ] Anurag Sharma edited comment on SOLR-6307 at 9/22/14 12:00 PM: --------------------------------------------------------------- Here is the code snippet of remove function. fieldValue is an Object containing items to be removed. {quote} final Collection original = existingField.getValues(); if (fieldVal instanceof Collection) \{ original.removeAll((Collection) fieldVal); \} else \{ original.remove(fieldVal); \ } {quote} The type of fieldVal is parsed by org.noggit.JSONParser. To describe more on #3, "original.removeAll((Collection) fieldVal);" is only successful when collection items of original and fieldVal are of the same type. So before making above call another collection can be be build at runtime containing same item type as the item types of original by typecasting the value(s) from fieldVal and pass them like: original.removeAll(typeCastedCollectionOfInputItems); This approach has minimal code change and will impact only doRemove() function in DistributedUpdateProcessor class. was (Author: anuragsharma): Here is the code snippet of remove function. fieldValue is an Object containing items to be removed. {quote} final Collection original = existingField.getValues(); if (fieldVal instanceof Collection) { original.removeAll((Collection) fieldVal); } else { original.remove(fieldVal); } {quote} The type of fieldVal is parsed by org.noggit.JSONParser. To describe more on #3, "original.removeAll((Collection) fieldVal);" is only successful when collection items of original and fieldVal are of the same type. So before making above call another collection can be be build at runtime containing same item type as the item types of original by typecasting the value(s) from fieldVal and pass them like: original.removeAll(typeCastedCollectionOfInputItems); This approach has minimal code change and will impact only doRemove() function in DistributedUpdateProcessor class. > Atomic update remove does not work for int array or date array > -------------------------------------------------------------- > > Key: SOLR-6307 > URL: https://issues.apache.org/jira/browse/SOLR-6307 > Project: Solr > Issue Type: Bug > Components: update > Affects Versions: 4.9 > Reporter: Kun Xi > Labels: atomic, difficulty-medium, impact-medium > > Try to remove an element in the string array with curl: > {code} > curl http://localhost:8080/update\?commit\=true -H 'Content-type:application/json' -d '[{ "attr_birth_year_is": { "remove": [1960]}, "id": 1098}]' > curl http://localhost:8080/update\?commit\=true -H 'Content-type:application/json' -d '[{"reserved_on_dates_dts": {"remove": ["2014-02-12T12:00:00Z", "2014-07-16T12:00:00Z", "2014-02-15T12:00:00Z", "2014-02-21T12:00:00Z"]}, "id": 1098}]' > {code} > Neither of them works. > The set and add operation for int array works. > The set, remove, and add operation for string array works -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org For additional commands, e-mail: dev-help@lucene.apache.org