lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brisbart Franck <Franck.Brisb...@kelkoo.net>
Subject Re: query matching all documents
Date Thu, 22 May 2003 13:32:05 GMT
You don't really need to take care of the deleted docs. When you'll try 
to get a deleted doc (reader.document(i) on a deleted doc), a 
IllegalArgumentException will thrown with the message 'attempt to access 
a deleted document'. Just catch this exception.

Also, I suggest you to use 'numDocs()' instead of 'maxDoc()' to get the 
real number of documnets in the index.

Franck

Guilherme Barile wrote:
> As I said, I'm still getting started (didn't implement deleting
> documents yet). Any tips on checking this ?
> 
> On Thu, 2003-05-22 at 03:31, Morus Walter wrote:
> 
>>Guilherme Barile writes:
>>
>>>If you're trying to get all documents, why not
>>>
>>>IndexReader reader = IndexReader.open(this.indexDir);
>>>Document doc;
>>>	
>>>for (int i = 0; i < reader.maxDoc(); i++) {
>>>	try {
>>>		doc = reader.document(i);
>>>		System.out.println(i + " " + doc.get("source"));
>>>	}
>>>	catch (Exception e) {
>>>		System.out.println("Error getting doc " + i);
>>>	}
>>>}
>>>
>>
>>I guess there should be some extra check to take care of deleted
>>documents, that aren't removed from the index yet.
>>
>>greetings
>>	Morus
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: lucene-user-help@jakarta.apache.org
>>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-user-help@jakarta.apache.org
> 


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


Mime
View raw message