I think I kown why lucene do not implement IndexReader.deleteDocument(Query)
when use IndexReader.deleteDocument(docId), reader set this docId in IndexReader with BitVictor, not delete real document in index. so it will influence search result in real time. And lucene retrieve 100 Hit in first time,if you want retrieve another Hit, lucene will search again and return the Hit you want. That is why this problem happen. poor english :") ---------- Forwarded message ---------- From: 游泳池的鱼 <[EMAIL PROTECTED]> Date: 2007-12-19 下午7:15 Subject: Re: document deletion problem To: java-user@lucene.apache.org we can iterator hits.id(i) but can't pass reader.deleteDocument(hits.id(i)); why? 2007/12/19, Tushar B <[EMAIL PROTECTED]>: > > 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: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >