Bug in IndexWriter.OptimizeMergesPending
----------------------------------------

                 Key: LUCENENET-123
                 URL: https://issues.apache.org/jira/browse/LUCENENET-123
             Project: Lucene.Net
          Issue Type: Bug
         Environment: Lucene.Net 2.3.1
            Reporter: Digy
         Attachments: IndexWriter.patch

Since "runningMerges" is a Hashtable,  its current item is "DictionaryEntry 
"not "OneMerge".

Test Code is below:
{code}
        int Count=0;
        Lucene.Net.Documents.Document GetDoc()
        {
            Lucene.Net.Documents.Document doc = new 
Lucene.Net.Documents.Document();
            doc.Add( new 
Lucene.Net.Documents.Field("id",Count.ToString(),Lucene.Net.Documents.Field.Store.YES,Lucene.Net.Documents.Field.Index.TOKENIZED)
 );
            return doc;
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            Lucene.Net.Store.RAMDirectory ramDir = new 
Lucene.Net.Store.RAMDirectory();
            Lucene.Net.Index.IndexWriter wr = new 
Lucene.Net.Index.IndexWriter(ramDir, new 
Lucene.Net.Analysis.WhitespaceAnalyzer(), true);
            wr.SetMaxBufferedDocs(5);
            wr.SetMergeFactor(5);
            for (int i = 0; i < 20; i++)
            {
                wr.AddDocument(GetDoc());
            }
            wr.Optimize();
            wr.Close();
        }
{code}

DIGY


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to