You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by OJ <li...@aurebekk.net> on 2004/05/18 13:18:56 UTC

IndexWriter.docCount() reporting 0

Hi!

I'm having some trouble with an index of mine. Basically, I'm having a
content managment system with a timertask that regularily triggers an
indexing method. This method indexes content that has been added to the
CMS since last excecution of the indexing method. This all works fine...
Or so it seems. During this weekend I ran an automated test where I
change, add and delete objects in the CMS to see if they are indexed
alright. After some 13 hours of reporting numbers between 120-160
documents, my IndexWriter suddenly reported 0 (and kept on doing it for 2
days). There was no Exception prior to this - it just happened. A simple
restart made the index work again, so I guess the actual index folder
content is allright.

Basically, all I do is :

on timed intervals {
   create org.apache.lucene.index.IndexReader indexReader from basedir;
   while( there are changed/deleted documents ) {
      indexReader.delete( some term );
   }
   indexReader.close()
   create org.apache.lucene.index.IndexWriter indexWriter from basedir;
   while( there are added/changed documents ){
      create org.apache.lucene.document.Document and add fields;
      indexWriter.addDocument();
   }
   indexWriter.optimize();
   system.out.println( "I am indexing " + indexWriter.docCount() );
   indexWriter.close();
}

Has anyone experienced similar problems? Anyone found a way to "kick" the
IndexWriter back into action without restarting?
I'm running Resin 2.1.10 on windows XP, java version 1.4.2_03 and Lucene
version 1.3 final.

OJ

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