You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by zMk Bnc <zi...@hotmail.com> on 2010/08/07 03:27:44 UTC

How do add multivalued entries

Hi everybody,
I am trying to add a multivalued content, so an item can belong to class A and class B at the same time. 
On schema.xml I have a definition that goes:
    <fieldType name="typeCatalog" class="solr.TextField" sortMissingLast="true" omitNorms="true">      <analyzer>        <tokenizer class="solr.PatternTokenizerFactory" pattern="; *" />           <filter class="solr.LowerCaseFilterFactory" />        <filter class="solr.TrimFilterFactory" />        <filter class="solr.PatternReplaceFilterFactory" pattern="([^a-z0-9])" replacement="" replace="all" />      </analyzer>    </fieldType>
And then a field:
   <field name="catalog" type="typeCatalog" indexed="true" stored="true" multivalued="true" required="true"/> 
When adding an element "xx", for example, I am sending the string "Biology; Cience" to "catalog", expecting to have to "Biology" and "Cience" as different entries for the element "xx".However, what I receive is "Biology; Cience" as a mono-valued instead of multi-valued.
Anyone any ideas on how to fix this?
Cheers! 		 	   		  

Re: How do add multivalued entries

Posted by Lance Norskog <go...@gmail.com>.
You send the two strings separately with the same field name. They
will aggregate and both become separate values.

On Fri, Aug 6, 2010 at 6:27 PM, zMk Bnc <zi...@hotmail.com> wrote:
>
> Hi everybody,
> I am trying to add a multivalued content, so an item can belong to class A and class B at the same time.
> On schema.xml I have a definition that goes:
>    <fieldType name="typeCatalog" class="solr.TextField" sortMissingLast="true" omitNorms="true">      <analyzer>        <tokenizer class="solr.PatternTokenizerFactory" pattern="; *" />           <filter class="solr.LowerCaseFilterFactory" />        <filter class="solr.TrimFilterFactory" />        <filter class="solr.PatternReplaceFilterFactory" pattern="([^a-z0-9])" replacement="" replace="all" />      </analyzer>    </fieldType>
> And then a field:
>   <field name="catalog" type="typeCatalog" indexed="true" stored="true" multivalued="true" required="true"/>
> When adding an element "xx", for example, I am sending the string "Biology; Cience" to "catalog", expecting to have to "Biology" and "Cience" as different entries for the element "xx".However, what I receive is "Biology; Cience" as a mono-valued instead of multi-valued.
> Anyone any ideas on how to fix this?
> Cheers!



-- 
Lance Norskog
goksron@gmail.com