If this happens rarely and you want to deal with in on the way into Solr,
you could just keep one of the values, using URP:
http://lucene.apache.org/solr/4_6_0/solr-core/org/apache/solr/update/processor/FirstFieldValueUpdateProcessorFactory.html

Regards,
   Alex

Personal website: http://www.outerthoughts.com/
LinkedIn: http://www.linkedin.com/in/alexandrerafalovitch
- Time is the quality of nature that keeps events from happening all at
once. Lately, it doesn't seem to be working.  (Anonymous  - via GTD book)


On Wed, Dec 18, 2013 at 2:20 PM, Liu Bo <diabl...@gmail.com> wrote:

> Hey Furkan and solr users
>
> This is a miss reported problem. It's not solr problem but our data issue.
> Sorry for this.
>
> It's a data issue of our side, a coupon happened to have two piece English
> description, which is not allowed in our business logic, but it happened
>  and we added twice of the name_en_US to solr document.
>
> I've done a set of test and deep debugging to solr source code, and found
> out that a array like string such as  [Get 20% Off Official Barca Kits,
> coupon] won't be treated as multivalued field.
>
> Sorry again for not digging more before sent out question email. I trust
> our business logic and data integrity more than solr, I will definitely not
> do this again. ;-)
>
> All the best
>
> Liu Bo
>
>
>
> On 11 December 2013 07:21, Furkan KAMACI <furkankam...@gmail.com> wrote:
>
> > 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 <diabl...@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
> > >
> >
>
>
>
> --
> All the best
>
> Liu Bo
>

Reply via email to