FIrst question: Is the "name" field stored (stored="true")? If it isn't,
that would explain your problems with that field. _all_ relevant fields
(i.e. everything not a destination of a copyField) need to be stored for
atomic updates to work.
Your second problem I'm not sure about. I remember some JIRAs about
multivalued fields and atomic updates, you might get some info from the
JIRAs here: https://issues.apache.org/jira/browse/SOLR

but updating multiValued fields _should_ work...

Best
Erick


On Tue, Dec 18, 2012 at 2:20 AM, Dikchant Sahi <contacts...@gmail.com>wrote:

> Hi,
>
> Does Solr 4.0 allows to update the values of multi-valued field? Say I have
> list of values for skills field like java, j2ee and i want to change it
> to solr, lucene.
>
> I was trying to play with atomic updates and below is my observation:
>
> I have following document in my index:
> <doc>
> <str name="id">1</str>
> <str name="name">Dikchant</str>
> <str name="profession">software engineer</str>
> <arr name="skills">
> <str>java</str>
> <str>j2ee</str>
> </arr>
> </doc>
>
> To update the skills to solr, lucene, I indexed document as follows:
>
> *<add>*
> *  <doc>*
> *    <field name="id">1</field>*
> *    <field name="skills" update="set">solr</field>*
> *    <field name="skills" update="set">lucene</field>*
> *  </doc>*
> *</add>*
>
> The document added to index is as follows:
> *<doc>*
> *  <str name="id">1</str>*
> *  <arr name="skills">*
> *    <str>{set=solr}</str>*
> *    <str>{set=lucene}</str>*
> *  </arr>*
> *</doc>*
>
> This is not what I was looking for. I found 2 issues:
> 1. The value of name field was lost
> 2. The skills fields had some junks like *{set=solr}*
> *
> *
> *
> *
> Then, to achieve my goal, I tried something different. I tried setting some
> single valued field with update="set" parameter to the same value and also
> provided the values of multi-valued field as we do while adding new
> document.
> <add>
>   <doc>
>     <field name="id">1</field>
>     *<field name="name" update="set">Dikchant</field>*
>     <field name="skills">solr</field>
>     <field name="skills">lucene</field>
>   </doc>
> </add>
>
> With this the index looks as follows:
> <doc>
> <str name="id">1</str>
> <str name="name">Dikchant</str>
> <str name="profession">software engineer</str>
> <arr name="skills">
> <str>solr</str>
> <str>lucene</str>
> </arr>
> </doc>
>
> The values of multivalued field is changed and value of other field is not
> deleted.
>
> The question that comes to my mind is, does Solr 4.0 allows update of
> multi-valued field? if yes, is this how it works or am I doing something
> wrong?
>
> Regards,
> Dikchant
>

Reply via email to