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 Pramod Goyal <pr...@gmail.com> on 2010/11/17 05:50:00 UTC

Issue with copyField when updating document

Hi,
     I am facing a issue with copyFields in SOlr. Here is what i am doing

Schema:

   <field name="ID" type="string" indexed="true" stored="true"/>
   <field name="product" type="string" indexed="true" stored="true"
multiValued="true"/>
   <field name="product_copy" type="text" indexed="true" stored="true"
multiValued="true"/>

   <copyField source="product" dest="proudct_copy"/>


I insert a document with say ID as 100 and product as sampleproduct. When i
view the document in the solr admin page i see the correct value for
the product_copy field ( same as the prodcut field ).
Next i try to update this document and for the field product i give 2 values
sampleproduct and testproduct. When i view the document on the solr admin
now
it show me 3 values in the copy field i.e. sampleproduct, testproduct and
sampleproduct ( the initial value in the copy field is retained even on
update ).

Why is copyFiled retaining the old values when the original field value has
been updated. If i update the document multiple times all the old values are
still retained in the copyField.

Note that i am using the solrJ api to insert the document. I tried setting
null values for the copy field when i am updating the document but it didnt
solve the problem.

Re: Issue with copyField when updating document

Posted by Lance Norskog <go...@gmail.com>.
Have you tried removing the index files and rebuilding it from
scratch? The index could be corrupted. It's rare, but it does happen.

On Thu, Nov 18, 2010 at 9:30 AM, Pramod Goyal <pr...@gmail.com> wrote:
> Hi,
> Forgot to mention solr version number:
>
> Solr Implementation Version: 2010-04-30_08-05-41 939580 - hudson -
> 2010-04-30 08:37:22
>
> On Thu, Nov 18, 2010 at 10:50 PM, Pramod Goyal <pr...@gmail.com>wrote:
>
>> I am using the solr admin to query the document. The returned document is
>> showing old values.
>>
>> Lance,
>> I will not be able to post my configuration but i will create a simple
>> schema just to highlight the issue.
>>
>>
>> On Wed, Nov 17, 2010 at 9:56 PM, Erick Erickson <er...@gmail.com>wrote:
>>
>>> How are you looking at the document? You mention using admin,
>>> are you searching?
>>>
>>> Because if you're looking at *terms* rather then the document,
>>> you should be aware that deleting a document does NOT remove
>>> the terms from the index, it just marks the doc as deleted.
>>>
>>> An optimize will remove the deleted document's terms.
>>>
>>> As Lance says, though, if you're displaying the document you
>>> should not be seeing the original values.
>>>
>>> Best
>>> Erick
>>>
>>> On Tue, Nov 16, 2010 at 11:50 PM, Pramod Goyal <pramod.goyal@gmail.com
>>> >wrote:
>>>
>>> > Hi,
>>> >     I am facing a issue with copyFields in SOlr. Here is what i am doing
>>> >
>>> > Schema:
>>> >
>>> >   <field name="ID" type="string" indexed="true" stored="true"/>
>>> >   <field name="product" type="string" indexed="true" stored="true"
>>> > multiValued="true"/>
>>> >   <field name="product_copy" type="text" indexed="true" stored="true"
>>> > multiValued="true"/>
>>> >
>>> >   <copyField source="product" dest="proudct_copy"/>
>>> >
>>> >
>>> > I insert a document with say ID as 100 and product as sampleproduct.
>>> When i
>>> > view the document in the solr admin page i see the correct value for
>>> > the product_copy field ( same as the prodcut field ).
>>> > Next i try to update this document and for the field product i give 2
>>> > values
>>> > sampleproduct and testproduct. When i view the document on the solr
>>> admin
>>> > now
>>> > it show me 3 values in the copy field i.e. sampleproduct, testproduct
>>> and
>>> > sampleproduct ( the initial value in the copy field is retained even on
>>> > update ).
>>> >
>>> > Why is copyFiled retaining the old values when the original field value
>>> has
>>> > been updated. If i update the document multiple times all the old values
>>> > are
>>> > still retained in the copyField.
>>> >
>>> > Note that i am using the solrJ api to insert the document. I tried
>>> setting
>>> > null values for the copy field when i am updating the document but it
>>> didnt
>>> > solve the problem.
>>> >
>>>
>>
>>
>



-- 
Lance Norskog
goksron@gmail.com

Re: Issue with copyField when updating document

Posted by Pramod Goyal <pr...@gmail.com>.
Hi,
Forgot to mention solr version number:

Solr Implementation Version: 2010-04-30_08-05-41 939580 - hudson -
2010-04-30 08:37:22

On Thu, Nov 18, 2010 at 10:50 PM, Pramod Goyal <pr...@gmail.com>wrote:

> I am using the solr admin to query the document. The returned document is
> showing old values.
>
> Lance,
> I will not be able to post my configuration but i will create a simple
> schema just to highlight the issue.
>
>
> On Wed, Nov 17, 2010 at 9:56 PM, Erick Erickson <er...@gmail.com>wrote:
>
>> How are you looking at the document? You mention using admin,
>> are you searching?
>>
>> Because if you're looking at *terms* rather then the document,
>> you should be aware that deleting a document does NOT remove
>> the terms from the index, it just marks the doc as deleted.
>>
>> An optimize will remove the deleted document's terms.
>>
>> As Lance says, though, if you're displaying the document you
>> should not be seeing the original values.
>>
>> Best
>> Erick
>>
>> On Tue, Nov 16, 2010 at 11:50 PM, Pramod Goyal <pramod.goyal@gmail.com
>> >wrote:
>>
>> > Hi,
>> >     I am facing a issue with copyFields in SOlr. Here is what i am doing
>> >
>> > Schema:
>> >
>> >   <field name="ID" type="string" indexed="true" stored="true"/>
>> >   <field name="product" type="string" indexed="true" stored="true"
>> > multiValued="true"/>
>> >   <field name="product_copy" type="text" indexed="true" stored="true"
>> > multiValued="true"/>
>> >
>> >   <copyField source="product" dest="proudct_copy"/>
>> >
>> >
>> > I insert a document with say ID as 100 and product as sampleproduct.
>> When i
>> > view the document in the solr admin page i see the correct value for
>> > the product_copy field ( same as the prodcut field ).
>> > Next i try to update this document and for the field product i give 2
>> > values
>> > sampleproduct and testproduct. When i view the document on the solr
>> admin
>> > now
>> > it show me 3 values in the copy field i.e. sampleproduct, testproduct
>> and
>> > sampleproduct ( the initial value in the copy field is retained even on
>> > update ).
>> >
>> > Why is copyFiled retaining the old values when the original field value
>> has
>> > been updated. If i update the document multiple times all the old values
>> > are
>> > still retained in the copyField.
>> >
>> > Note that i am using the solrJ api to insert the document. I tried
>> setting
>> > null values for the copy field when i am updating the document but it
>> didnt
>> > solve the problem.
>> >
>>
>
>

Re: Issue with copyField when updating document

Posted by Pramod Goyal <pr...@gmail.com>.
I am using the solr admin to query the document. The returned document is
showing old values.

Lance,
I will not be able to post my configuration but i will create a simple
schema just to highlight the issue.

On Wed, Nov 17, 2010 at 9:56 PM, Erick Erickson <er...@gmail.com>wrote:

> How are you looking at the document? You mention using admin,
> are you searching?
>
> Because if you're looking at *terms* rather then the document,
> you should be aware that deleting a document does NOT remove
> the terms from the index, it just marks the doc as deleted.
>
> An optimize will remove the deleted document's terms.
>
> As Lance says, though, if you're displaying the document you
> should not be seeing the original values.
>
> Best
> Erick
>
> On Tue, Nov 16, 2010 at 11:50 PM, Pramod Goyal <pramod.goyal@gmail.com
> >wrote:
>
> > Hi,
> >     I am facing a issue with copyFields in SOlr. Here is what i am doing
> >
> > Schema:
> >
> >   <field name="ID" type="string" indexed="true" stored="true"/>
> >   <field name="product" type="string" indexed="true" stored="true"
> > multiValued="true"/>
> >   <field name="product_copy" type="text" indexed="true" stored="true"
> > multiValued="true"/>
> >
> >   <copyField source="product" dest="proudct_copy"/>
> >
> >
> > I insert a document with say ID as 100 and product as sampleproduct. When
> i
> > view the document in the solr admin page i see the correct value for
> > the product_copy field ( same as the prodcut field ).
> > Next i try to update this document and for the field product i give 2
> > values
> > sampleproduct and testproduct. When i view the document on the solr admin
> > now
> > it show me 3 values in the copy field i.e. sampleproduct, testproduct and
> > sampleproduct ( the initial value in the copy field is retained even on
> > update ).
> >
> > Why is copyFiled retaining the old values when the original field value
> has
> > been updated. If i update the document multiple times all the old values
> > are
> > still retained in the copyField.
> >
> > Note that i am using the solrJ api to insert the document. I tried
> setting
> > null values for the copy field when i am updating the document but it
> didnt
> > solve the problem.
> >
>

Re: Issue with copyField when updating document

Posted by Erick Erickson <er...@gmail.com>.
How are you looking at the document? You mention using admin,
are you searching?

Because if you're looking at *terms* rather then the document,
you should be aware that deleting a document does NOT remove
the terms from the index, it just marks the doc as deleted.

An optimize will remove the deleted document's terms.

As Lance says, though, if you're displaying the document you
should not be seeing the original values.

Best
Erick

On Tue, Nov 16, 2010 at 11:50 PM, Pramod Goyal <pr...@gmail.com>wrote:

> Hi,
>     I am facing a issue with copyFields in SOlr. Here is what i am doing
>
> Schema:
>
>   <field name="ID" type="string" indexed="true" stored="true"/>
>   <field name="product" type="string" indexed="true" stored="true"
> multiValued="true"/>
>   <field name="product_copy" type="text" indexed="true" stored="true"
> multiValued="true"/>
>
>   <copyField source="product" dest="proudct_copy"/>
>
>
> I insert a document with say ID as 100 and product as sampleproduct. When i
> view the document in the solr admin page i see the correct value for
> the product_copy field ( same as the prodcut field ).
> Next i try to update this document and for the field product i give 2
> values
> sampleproduct and testproduct. When i view the document on the solr admin
> now
> it show me 3 values in the copy field i.e. sampleproduct, testproduct and
> sampleproduct ( the initial value in the copy field is retained even on
> update ).
>
> Why is copyFiled retaining the old values when the original field value has
> been updated. If i update the document multiple times all the old values
> are
> still retained in the copyField.
>
> Note that i am using the solrJ api to insert the document. I tried setting
> null values for the copy field when i am updating the document but it didnt
> solve the problem.
>

Re: Issue with copyField when updating document

Posted by Lance Norskog <go...@gmail.com>.
This very definitely should not happen.

Can you remove the index and reindex everything? And then do these 
iterative tests?

Which version of Solr are you running?

If these changes do not cure the problem, can you post your schema.xml 
and solrconfig.xml?

Pramod Goyal wrote:
> Hi,
>       I am facing a issue with copyFields in SOlr. Here is what i am doing
>
> Schema:
>
>     <field name="ID" type="string" indexed="true" stored="true"/>
>     <field name="product" type="string" indexed="true" stored="true"
> multiValued="true"/>
>     <field name="product_copy" type="text" indexed="true" stored="true"
> multiValued="true"/>
>
>     <copyField source="product" dest="proudct_copy"/>
>
>
> I insert a document with say ID as 100 and product as sampleproduct. When i
> view the document in the solr admin page i see the correct value for
> the product_copy field ( same as the prodcut field ).
> Next i try to update this document and for the field product i give 2 values
> sampleproduct and testproduct. When i view the document on the solr admin
> now
> it show me 3 values in the copy field i.e. sampleproduct, testproduct and
> sampleproduct ( the initial value in the copy field is retained even on
> update ).
>
> Why is copyFiled retaining the old values when the original field value has
> been updated. If i update the document multiple times all the old values are
> still retained in the copyField.
>
> Note that i am using the solrJ api to insert the document. I tried setting
> null values for the copy field when i am updating the document but it didnt
> solve the problem.
>
>