lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Will Palmeri" <w...@imeem.com>
Subject IndexOutOfRangeException when adding Document to index
Date Sat, 28 Jun 2008 01:22:41 GMT
I just checked out the 2.3.1 code from svn and built a fresh dll to try
out with our existing codebase. (We had been using 2.0.5).  A couple of
my indexes are working just fine, but for one of them when I get to
around 1000 documents,  I get sporadic IndexOutOfRangeExceptions when
calling IndexWriter.AddDocument(Document)

 

I stepped through the code and drilled down to where the exception is
getting thrown.  When processing a single term in a given field, the
method AllocSlice of the internal class ByteBlockPool in
DocumentsWriter.cs is called.

 

In AllocSlice, the variable level is computed by AND'ing a value from
slice array with 15 (0xf).  However, in the next line 'level' is used to
index into DocumentsWriter.nextLevelArray.  At runtime, this array was
only of length 10, so occasionally when level was >= 10, the
IndexOutOfRangeException would be thrown.

 

On line 3410, nextLevelArray is initialized:

internal static readonly int[] nextLevelArray = new int[]{1, 2, 3, 4, 5,
6, 7, 8, 9, 9};

 

I'm not familiar with the codebase, so I have no idea what this code
does specifically. But it seems to me that line 3510 should be:

int level = slice[upto] & DocumentsWriter.nextLevelArray.Length

 

 

I'm looking forward to using 2.3.1, hope this helps!

 

-Will

imeem.com


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message