Lucene 2.3.1(a?) - Unhandled System.NullReferenceException In
Lucene.Net.Index.DocumentsWriter.CompareText
-----------------------------------------------------------------------------------------------------------
Key: LUCENENET-125
URL: https://issues.apache.org/jira/browse/LUCENENET-125
Project: Lucene.Net
Issue Type: Bug
Environment: Microsoft Visual Studio 2005, XP Pro
Reporter: Ken Katzgrau
When creating a test index of a 1,000,000 documents, I encountered a null
reference exception originating from the document writer approximately every
80,000 documents. The code producing this error is:
class Program
{
static void Main(string[] args)
{
IndexWriter iw = new IndexWriter(@"C:\TestIndex", new
WhitespaceAnalyzer(), true);
Document d;
Field f;
for (int i = 0; i < 100000; i++)
{
if (i % 10000 == 0) Console.WriteLine("Doc: " + i);
d = new Document();
f = new Field("Field1", "Content " + i, Field.Store.YES,
Field.Index.UN_TOKENIZED);
d.Add(f);
f = new Field("Field2", "Content " + i, Field.Store.YES,
Field.Index.UN_TOKENIZED);
d.Add(f);
iw.AddDocument(d); *Exception occurs here
}
Console.WriteLine(iw.DocCount());
Console.ReadKey();
iw.Close(); *If the exception is caught, the IndexWriter iw becomes
null
}
}
The exception is:
System.NullReferenceException was unhandled
Message="Object reference not set to an instance of an object."
Source="Lucene.Net"
StackTrace:
at Lucene.Net.Index.DocumentsWriter.CompareText(Char[] text1, Int32
pos1, Char[] text2, Int32 pos2)
at Lucene.Net.Index.DocumentsWriter.AppendPostings(FieldData[] fields,
TermInfosWriter termsOut, IndexOutput freqOut, IndexOutput proxOut)
at Lucene.Net.Index.DocumentsWriter.WriteSegment()
at Lucene.Net.Index.DocumentsWriter.Flush(Boolean closeDocStore)
at Lucene.Net.Index.IndexWriter.DoFlush(Boolean flushDocStores)
at Lucene.Net.Index.IndexWriter.Flush(Boolean triggerMerge, Boolean
flushDocStores)
at Lucene.Net.Index.IndexWriter.AddDocument(Document doc, Analyzer
analyzer)
at Lucene.Net.Index.IndexWriter.AddDocument(Document doc)
-- Line Removed --
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence
assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.