Java – Lucene Error While Reading binary block :


I am getting while reading a binary block from lucene index. I am storing java object as byte-array in lucene index field and reading it when hit occurs.

Here is stack trace :

Caused by:
at org.terracotta.modules.searchable.util.SerializationUtil$OIS.(

I have some background threads which write into index. But i buffer them and then write them at once like 1000. Occasionally I also issue optimize() on index. When I write, I am re-opening IndexReader. Does this is happening because of IndexReader re-opening call?



Best Solution

This does not look like it has anything to do directly with lucene. Rather, the exception occurs in the terracotta module. Apparently while it is in the process of serializing, probably serializing your java files. I cannot find the javadocs for this module of terracotta, but it appears to me from the stack trace that the stream length of the streams are incorrectly specified to the serializer.

As Yuval F points out: lucene is not aimed at handling binary content. It is not a storage mechanism and should not be used as such. You cannot rely on getting a correctly serialized version of your bytecode back from lucene.

Related Question