lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From miztaken <>
Subject Strange Error while deleting Documents from index while indexing.
Date Thu, 26 Jul 2007 06:27:59 GMT

I am dumping the database tables into lucene documents.
I am doing like this:

1. Get the rowset from database to be stored as Lucene Document.
2. Open IndexReader and check if they are already indexed.
   If Indexed, delete them and add the new rowset.
   Continue this till the end
3. Close IndexReader
4. Open IndexWriter
5. Write the same rowset in the index.
6. delete the rowset from database..
7. Repeat the same process[step 1 - step 7 ] till there are records in

Like this i am doing Indexing and deletion.
Some key points:
1. New indexWriter is opened when there is not instance of indexwriter
available,but if available it makes use of the same IndexWriter. i.e. My
index Writer opens once in Step 4 and after that the whole process makes use
of it.
2. But i open indexReader for each deletion and close.
3. I optimize IndexWriter after certain threshold is crossed.

Now my problem is:
In the first deletion of document (if present) in step 2 and closing of
indexreader in step 3. I get no error.
But in the second loop, i get the error while trying to close the

The error is : 
Unable to cast object of type 'System.Collections.DictionaryEntry' to type

Stack Trace:
   at Lucene.Net.Index.IndexFileDeleter.DeleteFiles(ArrayList files)
   at Lucene.Net.Index.IndexFileDeleter.DeleteFiles()
   at Lucene.Net.Index.IndexFileDeleter.CommitPendingFiles()
   at Lucene.Net.Index.IndexReader.Commit()
   at Lucene.Net.Index.IndexReader.Close()
   at QueryDatabaseForIndexing.Program.Main(String[] args) in E:\Test
Applications\ORS Lucene Developments\July 25\
TotalIndexingAndSearching_25_july\T otalIndexingAndSearching\  
QueryDatabaseForIndexing \Program2.cs:line 159

I dont know whats the cause of this error.

I am in real need of help.
Please help me find error.

View this message in context:
Sent from the Lucene - Java Users mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message