Mailing List Archive

Reading back binary fields
Hey Gang!

I'm having some problems when modifying an existing index, adding a binary
field to each document. Or more specifically, I have a problem reading back
that field. I'm using the IndexModifier from the trunk, and I am positive
that the binary field gets written down, since the field name shows up in in
Luke.

The index modification is nothing out of the ordinary.
-----------------
int i = some integer
Document doc = indexReader.document(i);
indexModifier.delete(i);
Field tvField = new Field(TV_FIELD_NAME,aByteArray,Field.Store.YES);
doc.add(tvField);
indexModifer.addDocument(doc);
indexModifier.optimize();
indexModifier.close();
-----------------

However, when I re-read that document at a later point in time, and iterate
the doc.fields() enumeration, the TV_FIELD_NAME field does not show up. Luke
shows that field, though - what's the trick?

On a side-note, I have modified the IndexModifier to use write/delete
buffers, so that when some defined buffer size overflows, the buffers
flushes down their stuff to the internal indexReader and indexWriter in
delete-write order. It increased the speed tremendously compared to the old
IndexModifier, which doesn't use any form of internal buffering. If this is
something you want comitted to the Lucene trunk, give me a shout and I'll
clean it up.

Thanks,
Fredrik
Re: Reading back binary fields [ In reply to ]
Problem solved, it was a problem located elsewhere in the code not related
to Lucene. Sorry!

Fredrik

On 9/29/05, Fredrik Andersson <fidde.andersson@gmail.com> wrote:
>
> Hey Gang!
>
> I'm having some problems when modifying an existing index, adding a binary
> field to each document. Or more specifically, I have a problem reading back
> that field. I'm using the IndexModifier from the trunk, and I am positive
> that the binary field gets written down, since the field name shows up in in
> Luke.
>
> The index modification is nothing out of the ordinary.
> -----------------
> int i = some integer
> Document doc = indexReader.document(i);
> indexModifier.delete(i);
> Field tvField = new Field(TV_FIELD_NAME,aByteArray,Field.Store.YES);
> doc.add(tvField);
> indexModifer.addDocument(doc);
> indexModifier.optimize();
> indexModifier.close();
> -----------------
>
> However, when I re-read that document at a later point in time, and
> iterate the doc.fields() enumeration, the TV_FIELD_NAME field does not
> show up. Luke shows that field, though - what's the trick?
>
> On a side-note, I have modified the IndexModifier to use write/delete
> buffers, so that when some defined buffer size overflows, the buffers
> flushes down their stuff to the internal indexReader and indexWriter in
> delete-write order. It increased the speed tremendously compared to the old
> IndexModifier, which doesn't use any form of internal buffering. If this is
> something you want comitted to the Lucene trunk, give me a shout and I'll
> clean it up.
>
> Thanks,
> Fredrik
>