Return-Path: Delivered-To: apmail-lucene-solr-dev-archive@minotaur.apache.org Received: (qmail 48894 invoked from network); 11 Aug 2009 13:28:31 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 11 Aug 2009 13:28:31 -0000 Received: (qmail 49425 invoked by uid 500); 11 Aug 2009 13:28:37 -0000 Delivered-To: apmail-lucene-solr-dev-archive@lucene.apache.org Received: (qmail 49335 invoked by uid 500); 11 Aug 2009 13:28:37 -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 49325 invoked by uid 99); 11 Aug 2009 13:28:37 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Aug 2009 13:28:37 +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; Tue, 11 Aug 2009 13:28:35 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id E483A234C046 for ; Tue, 11 Aug 2009 06:28:14 -0700 (PDT) Message-ID: <2060811317.1249997294935.JavaMail.jira@brutus> Date: Tue, 11 Aug 2009 06:28:14 -0700 (PDT) From: "Noble Paul (JIRA)" To: solr-dev@lucene.apache.org Subject: [jira] Issue Comment Edited: (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:comment-tabpanel&focusedCommentId=12741854#action_12741854 ] Noble Paul edited comment on SOLR-1357 at 8/11/09 6:27 AM: ----------------------------------------------------------- for the bean {code:java} public class MyBean{ @Field("brands_*) Map brands; ... } {code} the following should not work {code:java} brands.put("Nokia", 1000); brands.put("Samsung", 100); {code} but this should work {code:java} brands.put("brands_Nokia", 1000); brands.put("brands_Samsung", 100); {code} we may not need to support it is SolrInputDocument was (Author: noble.paul): for the bean {code:java} public class MyBean{ @Field("brands_*) Map brands; ... } {code} the following should not work {code:java} brands.put("Nokia", 1000); brands.put("brands_Samsung", 100); {code} but this should work {code:java} brands.put("brands_Nokia", 1000); brands.put("brands_Samsung", 100); {code} we may not need to support it is SolrInputDocument > 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 > > 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.