You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by luocanrao <lu...@sohu.com> on 2010/05/11 16:20:46 UTC

is there some dangerous bug in lucene?

I have a problem. I found the store field in a document is not consistent.

Here are some small case about my program.

 

Field A = new Filed(Store.Yes,FieldAValue);

FieldBValue.add(FieldAValue);            // FiledBValue is a container that
contains other store field value, FiledBValue is like a complete document
record

Field B = new Filed(Store.Yes,FieldBValue); 

Document doc = new Document;

doc.add(A); doc.add(B);

indexWriter.updateDocument(new Term(..),doc);

 

 

after a long time , today some body found some bug.

I observe that value of filed A is the old value, but the value of field B
is the new and right value.

At first I thought maybe it was the bug of indexwriter.getReader(), 

but after I restart the program, the bug is still existing.

Finally I have to reconstruct all the data to fix it.

 

Ps : I use FieldCache to store the value of field A, not field B

I use indexwriter.getReader() to get realtime search

 

I hope somebody to help me explain it. 


Re: is there some dangerous bug in lucene?

Posted by Chris Lu <ch...@gmail.com>.
If you are using field cache for field A, and updating field A, isn't it 
normal that the field A is not updated?

Field cache is keyed via index reader, it won't be efficient to reload 
the field cache for each updateDocument().

--
Chris Lu
-------------------------
Instant Scalable Full-Text Search On Any Database/Application
site: http://www.dbsight.net
demo: http://search.dbsight.com
Lucene Database Search in 3 minutes:
http://wiki.dbsight.com/index.php?title=Create_Lucene_Database_Search_in_3_minutes
DBSight customer, a shopping comparison site, (anonymous per request) 
got 2.6 Million Euro funding!

On 5/11/2010 7:20 AM, luocanrao wrote:
> I have a problem. I found the store field in a document is not consistent.
>
> Here are some small case about my program.
>
>
>
> Field A = new Filed(Store.Yes,FieldAValue);
>
> FieldBValue.add(FieldAValue);            // FiledBValue is a container that
> contains other store field value, FiledBValue is like a complete document
> record
>
> Field B = new Filed(Store.Yes,FieldBValue);
>
> Document doc = new Document;
>
> doc.add(A); doc.add(B);
>
> indexWriter.updateDocument(new Term(..),doc);
>
>
>
>
>
> after a long time , today some body found some bug.
>
> I observe that value of filed A is the old value, but the value of field B
> is the new and right value.
>
> At first I thought maybe it was the bug of indexwriter.getReader(),
>
> but after I restart the program, the bug is still existing.
>
> Finally I have to reconstruct all the data to fix it.
>
>
>
> Ps : I use FieldCache to store the value of field A, not field B
>
> I use indexwriter.getReader() to get realtime search
>
>
>
> I hope somebody to help me explain it.
>
>
>    


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: is there some dangerous bug in lucene?

Posted by Erick Erickson <er...@gmail.com>.
Is it possible that you're looking at the deleted document? When you update
a document you're actually deleting the old one and adding a new one....

If not, I second Ian's comment that a self-contained test case will be very
useful.

HTH
Erick

On Tue, May 11, 2010 at 11:25 AM, Ian Lea <ia...@gmail.com> wrote:

> > is there some dangerous bug in lucene?
>
> Highly unlikely.  Much more likely that there is a bug in your code,
> perhaps somewhere in the confusing (to me, reading your uncompilable
> code snippet) cross linking of values between fields A and B.  Or
> you've got duplicate docs in the index.  Or something completely
> different.
>
> If you really do think it is a problem in lucene itself, or in your
> usage of lucene, I suggest that you break it down to the smallest
> possible self-contained test case or program that demonstrates the
> problem and post it here.  And tell us what version of lucene you are
> using.  Before doing that it would be worth using Luke to examine the
> index to double check that it holds what you thing it does.
>
>
> --
> Ian.
>
>
> On Tue, May 11, 2010 at 3:20 PM, luocanrao <lu...@sohu.com>
> wrote:
> > I have a problem. I found the store field in a document is not
> consistent.
> >
> > Here are some small case about my program.
> >
> >
> >
> > Field A = new Filed(Store.Yes,FieldAValue);
> >
> > FieldBValue.add(FieldAValue);            // FiledBValue is a container
> that
> > contains other store field value, FiledBValue is like a complete document
> > record
> >
> > Field B = new Filed(Store.Yes,FieldBValue);
> >
> > Document doc = new Document;
> >
> > doc.add(A); doc.add(B);
> >
> > indexWriter.updateDocument(new Term(..),doc);
> >
> >
> >
> >
> >
> > after a long time , today some body found some bug.
> >
> > I observe that value of filed A is the old value, but the value of field
> B
> > is the new and right value.
> >
> > At first I thought maybe it was the bug of indexwriter.getReader(),
> >
> > but after I restart the program, the bug is still existing.
> >
> > Finally I have to reconstruct all the data to fix it.
> >
> >
> >
> > Ps : I use FieldCache to store the value of field A, not field B
> >
> > I use indexwriter.getReader() to get realtime search
> >
> >
> >
> > I hope somebody to help me explain it.
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

Re: is there some dangerous bug in lucene?

Posted by Ian Lea <ia...@gmail.com>.
> is there some dangerous bug in lucene?

Highly unlikely.  Much more likely that there is a bug in your code,
perhaps somewhere in the confusing (to me, reading your uncompilable
code snippet) cross linking of values between fields A and B.  Or
you've got duplicate docs in the index.  Or something completely
different.

If you really do think it is a problem in lucene itself, or in your
usage of lucene, I suggest that you break it down to the smallest
possible self-contained test case or program that demonstrates the
problem and post it here.  And tell us what version of lucene you are
using.  Before doing that it would be worth using Luke to examine the
index to double check that it holds what you thing it does.


--
Ian.


On Tue, May 11, 2010 at 3:20 PM, luocanrao <lu...@sohu.com> wrote:
> I have a problem. I found the store field in a document is not consistent.
>
> Here are some small case about my program.
>
>
>
> Field A = new Filed(Store.Yes,FieldAValue);
>
> FieldBValue.add(FieldAValue);            // FiledBValue is a container that
> contains other store field value, FiledBValue is like a complete document
> record
>
> Field B = new Filed(Store.Yes,FieldBValue);
>
> Document doc = new Document;
>
> doc.add(A); doc.add(B);
>
> indexWriter.updateDocument(new Term(..),doc);
>
>
>
>
>
> after a long time , today some body found some bug.
>
> I observe that value of filed A is the old value, but the value of field B
> is the new and right value.
>
> At first I thought maybe it was the bug of indexwriter.getReader(),
>
> but after I restart the program, the bug is still existing.
>
> Finally I have to reconstruct all the data to fix it.
>
>
>
> Ps : I use FieldCache to store the value of field A, not field B
>
> I use indexwriter.getReader() to get realtime search
>
>
>
> I hope somebody to help me explain it.
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org