lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 17242] New: - IllegalStateException: docs out of order after 10 insert/delete/optimize
Date Thu, 20 Feb 2003 12:46:18 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17242>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17242

IllegalStateException: docs out of order after 10 insert/delete/optimize

           Summary: IllegalStateException: docs out of order after 10
                    insert/delete/optimize
           Product: Lucene
           Version: 1.2rc5
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Critical
          Priority: Other
         Component: Store
        AssignedTo: lucene-dev@jakarta.apache.org
        ReportedBy: andrei@tandoev.de


The following JUnit Test leads to the error. The index becomes unusable.
Set the variable directory in the JUnit test.

---------------
java.lang.IllegalStateException: docs out of order

	at org.apache.lucene.index.SegmentMerger.appendPostings(Unknown Source)

	at org.apache.lucene.index.SegmentMerger.mergeTermInfo(Unknown Source)

	at org.apache.lucene.index.SegmentMerger.mergeTermInfos(Unknown Source)

	at org.apache.lucene.index.SegmentMerger.mergeTerms(Unknown Source)

	at org.apache.lucene.index.SegmentMerger.merge(Unknown Source)

	at org.apache.lucene.index.IndexWriter.mergeSegments(Unknown Source)

	at org.apache.lucene.index.IndexWriter.optimize(Unknown Source)

	at iproject.search.lucene.LuceneErrorTest.testLuceneError
(MyTest.java:58)

---------------
package test;
import junit.framework.*;
import org.apache.lucene.index.*;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.document.*;
import org.apache.lucene.store.*;
import org.apache.lucene.search.*;
import java.io.*;

public class MyTest extends TestCase {

    public MyTest(String s) {
        super(s);
    }

    protected void setUp() {
    }

    protected void tearDown() {
    }

    public void testError() throws IOException {
        String directory = "here the directory for a temporary index";

        org.apache.lucene.analysis.Analyzer a = new 
org.apache.lucene.analysis.WhitespaceAnalyzer();
        org.apache.lucene.document.Document idoc;
        org.apache.lucene.index.IndexWriter iw;
        org.apache.lucene.index.IndexReader ir;

        // empty the directory
        iw = new org.apache.lucene.index.IndexWriter(directory, a, true);
        iw.close();

        for( int k=0; k<50; k++ ) {
            System.out.println( "run # " + k );
            // add a document
            iw = new org.apache.lucene.index.IndexWriter(directory, a, false);
            try {
                idoc = new org.apache.lucene.document.Document();
                idoc.add( Field.Text("number", "abc") );
                iw.addDocument(idoc);
                iw.close();
/* if the next lines are commented, the call to optimize throws an IOException 
by k=10:
// java.lang.IllegalStateException: docs out of order
//     at org.apache.lucene.index.SegmentMerger.appendPostings(Unknown Source)
//     at org.apache.lucene.index.SegmentMerger.mergeTermInfo(Unknown Source)
//     at org.apache.lucene.index.SegmentMerger.mergeTermInfos(Unknown Source)
//     at org.apache.lucene.index.SegmentMerger.mergeTerms(Unknown Source)
//     at org.apache.lucene.index.SegmentMerger.merge(Unknown Source)
//     at org.apache.lucene.index.IndexWriter.mergeSegments(Unknown Source)
//     at org.apache.lucene.index.IndexWriter.optimize(Unknown Source)

            iw = new org.apache.lucene.index.IndexWriter(directory, a, false);
            iw.optimize();
            iw.close();
*/
                ir = org.apache.lucene.index.IndexReader.open(directory);
                for( int i=0; i<ir.maxDoc(); i++ )
                    ir.delete(i);
                ir.close();

                iw = new org.apache.lucene.index.IndexWriter(directory, a, 
false);
                iw.optimize();
            } finally {
                iw.close();
            }
        }

    }

}

---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org


Mime
View raw message