On 7/15/2015 3:01 AM, Martínez López, Alfonso wrote:
> <!--Fields-->
> <field name="id" type="string" indexed="true" stored="true" required="true" />
> <field name="name" type="string" indexed="true" stored="true" />
> <field name="src_desc" type="string" indexed="true" stored="true" />
> <field name="_version_" type="long" indexed="true" stored="true" /
> <!--Dynamic fields definition-->
> <dynamicField name="src_*" type="string" indexed="true" stored="true" 
> multiValued="false" />
> <dynamicField name="dinamic_*" type="string" indexed="true" stored="true" 
> multiValued="false" />
> <!--Copy fields-->
> <copyField source="src_*" dest="dinamic_*"/>

<snip>

> And later I update the field 'name' with this command:
>
> curl http://<solr_host>:<sorl_port>/solr/default/update?commit=true -H 
> "Content-Type: text/xml" --data-binary '<add><doc><field 
> name="id">1</field><field name="name" 
> update="set">paquico</field></doc></add>'
>
> As I do so the doc i retrive from Solr is:
>
> <result name="response" numFound="1" start="0" maxScore="1.0">
>  <doc>
>   <str name="id">1</str>
>   <str name="name">paquico</str>
>   <str name="src_desc">friend of mine</str>
>   <arr name="dinamic_desc">
>    <str>friend of mine</str>
>    <str>friend of mine</str>
>   </arr>
>   <long name="_version_">1506750859550130176</long>
>   <float name="score">1.0</float>
>  </doc>
> </result>

The problem here is that the copyField destination is stored, so you get
the original value of the destination field plus another copy from src_desc.

If you look carefully at the "caveats and limitations" for Atomic
Updates, you will see that all copyField destinations must be unstored
for proper operation:

https://wiki.apache.org/solr/Atomic_Updates#Caveats_and_Limitations

It appears that this information was *NOT* in the Solr Reference Guide,
so I updated the reference guide to include it.

https://cwiki.apache.org/confluence/display/solr/Updating+Parts+of+Documents

Here's a question for those with more expertise than me:  If a copyField
destination were stored, but not multiValued, and an atomic update was
attempted, would the update fail entirely?  I suspect it would, and I'd
like to make the ref guide info as accurate as I can.

Thanks,
Shawn

Reply via email to