Return-Path: Delivered-To: apmail-lucene-solr-dev-archive@minotaur.apache.org Received: (qmail 76384 invoked from network); 2 Dec 2009 10:42:46 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 2 Dec 2009 10:42:46 -0000 Received: (qmail 17060 invoked by uid 500); 2 Dec 2009 10:42:45 -0000 Delivered-To: apmail-lucene-solr-dev-archive@lucene.apache.org Received: (qmail 16973 invoked by uid 500); 2 Dec 2009 10:42:45 -0000 Mailing-List: contact solr-dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: solr-dev@lucene.apache.org Delivered-To: mailing list solr-dev@lucene.apache.org Received: (qmail 16963 invoked by uid 99); 2 Dec 2009 10:42:44 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 Dec 2009 10:42:44 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 Dec 2009 10:42:42 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 6FB2C234C052 for ; Wed, 2 Dec 2009 02:42:21 -0800 (PST) Message-ID: <1575406716.1259750541456.JavaMail.jira@brutus> Date: Wed, 2 Dec 2009 10:42:21 +0000 (UTC) From: "Lars Grote (JIRA)" To: solr-dev@lucene.apache.org Subject: [jira] Updated: (SOLR-1357) SolrInputDocument cannot process dynamic fields In-Reply-To: <2024825820.1249990215813.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/SOLR-1357?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Lars Grote updated SOLR-1357: ----------------------------- Attachment: SOLR-1357.patch So here is the patch. Maybe you can have a look at the testcase and the comment there, line 140. Just to make sure that this is the desired behavior. Regards, Lars > SolrInputDocument cannot process dynamic fields > ----------------------------------------------- > > Key: SOLR-1357 > URL: https://issues.apache.org/jira/browse/SOLR-1357 > Project: Solr > Issue Type: Improvement > Components: clients - java > Reporter: Avlesh Singh > Assignee: Noble Paul > Attachments: SOLR-1357.patch, SOLR-1357.patch > > > Adding data via {{SolrInputDocument}} is normally done by calling the {{addField}} method with a field name, field value and an optional boost. In case of dynamic fields, if field names are known upfront, then caller of this method just passes in the right name and it automatically works. > This does not go well with users who use {{@interface Field}} annotations for automatic binding. > As of SOLR-1129, users can annotate {{Map propertyName}} with {{@Field ("field_*")}} kind of annotations to bind dynamic field data to. {{SolrInputDocument}} should exhibit the same behavior. The field {{value}} currently supported are - primitive, array, collection or an instance of Iterable. It can also take {{Map}} as values. If the field, for which {{addField}} method is called, is of dynamicField type (which can be derived from the field name), then the keys of the {{Map}}, passed as value, should be used to "compose" the correct field name. > This should be supported > {code:java} > //This code sample should populate the dynamic fields "brands_Nokia" and "brands_Samsung" > public class MyBean{ > @Field("brands_*) > Map brands; > > ... > } > Map brands= new HashMap(); > brands.put("Nokia", 1000); > brands.put("Samsung", 100); > MyBean myBean = new MyBean(); > myBean.setBrands(brands); > solrServer.addBean(myBean); > {code} > We can think of supporting this too ... > {code:java} > //This code sample should populate the dynamic fields "brands_Nokia" and "brands_Samsung" > Map brands= new HashMap(); > brands.put("Nokia", 1000); > brands.put("Samsung", 100); > SolrInputDocument doc = new SolrInputDocument(); > doc.addField("brands_*", brands); > {code} -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.