lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chhabra, Kapil" <kchha...@akamai.com>
Subject RE: document deletion problem
Date Wed, 19 Dec 2007 11:09:50 GMT
Hi Tushar,
If you refer to the Javadocs for IndexReader, you'll come across the
following line:

"For efficiency, in this API documents are often referred to via
document numbers, non-negative integers which each name a unique
document in the index. These document numbers are ephemeral--they may
change as documents are added to and deleted from an index. Clients
should thus not rely on a given document having the same number between
sessions."

If its a single term that you are searching on, then its better to you
IndexReader's deleteDocuments(Term term)

> (initial vector size is 100 I guess).
Yes.

Hope it helps.

Regards.
kapilChhabra


-----Original Message-----
From: Tushar B [mailto:snowhow@sbcglobal.net] 
Sent: Wednesday, December 19, 2007 3:40 PM
To: java-user@lucene.apache.org
Subject: document deletion problem

Hello All, 

I am seeing this issue and would like to understand if its a bug or I am
missing something and doing the wrong way: 

(Note that I am doing all exception handling - but deleted the exception
handling code for sake of brevity below) 

Hits h = m_indexSearcher.search(q); // Returns 11475 documents for(int i
= 0; i < h.length(); i++) { int doc = h.id(i);
m_indexSearcher.getIndexReader().deleteDocument(doc);
} 

The above hits Vector::ArrayIndexOutOfBoundsException when i = 6400. The
problem happens in Hits::getMoreDocs.

By the time 6400 docs are deleted, the majority is gone and
topDocs.totalHits becomes less than 6400 (In this case 5075) and finally
causes exception in the last line of Hits::hitDoc.

I just took the example numbers which occured in my case but this
happens for any hits > 200 (initial vector size is 100 I guess).

Any insight on the logic here will be very helpful (note: I have a
workaround too)

thanks

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

http://lucene-faq.blogspot.com/ 

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


Mime
View raw message