lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Furkan KAMACI <furkankam...@gmail.com>
Subject Re: an "array" liked string is treated as multivalued when adding doc to solr
Date Tue, 10 Dec 2013 23:21:26 GMT
Hi Liu;

Yes. it is an expected behavior. If you send data within square brackets
Solr will behave it as a multivalued field. You can test it with this way:
if you use Solrj and use a List for a field it will be considered as
multivalued too because when you call toString() method of your List you
can see that elements are printed within square brackets. This is the
reason that a List can be used for a multivalued field.

If you explain your situation I can offer a way how to do it.

Thanks;
Furkan KAMACI


2013/12/6 Liu Bo <diablo47@gmail.com>

> Dear solr users:
>
> I've met this kind of error several times,
>
> when add a "array" liked string such as:[Get 20% Off Official Barça Kits,
> coupon] to a  multiValued="false" field, solr will complain:
>
> org.apache.solr.common.SolrException: ERROR: [doc=7781396456243918692]
> multiple values encountered for non multiValued field name_en_US: [Get 20%
> Off Official Barca Kits, coupon]
>
> my schema defination:
> <field name="name_en_US" type="text_en" indexed="true" stored="true"
> multiValued="false" />
>
> This field is stored as the search result needs this field and it's value
> in original format, and indexed to give it a boost while searching .
>
> What I do is adding name (java.lang.String) to SolrInputDocument by
> addField("name_en_US", product.getName()) method, and then add this to solr
> using an AddUpdateCommand
>
> It seems solr treats this kind of string data as multivalued, even I add
> this field to solr only once.
>
> Is this a bug or a supposed behavior?
>
> Is there any way to tell solr this is not a "multivalued value" add don't
> break it?
>
> Your help and suggestion will be much of my appreciation.
>
> --
> All the best
>
> Liu Bo
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message