On Thursday 26 January 2006 19:44, Chris Hostetter wrote:
> 
> : > The document number is the variable i in this case.
> : If the document number is the variable i (enumerated from numDocs()),
> : what's the difference between numDocs() and maxDoc() in this case? I
> : was previously under the impression that the internal docNum might be
> : different to the counter.
> 
> Iterating between 1 and maxDoc-1 will give you the range of all possible
> doc ids, but some of those docs may have already been deleted.  I believe
> that is what you want to do. ... you can check if a doc is deleted using
> IndexReader.isDeleted(i)
> 
> numDocs is implimented as maxDocs() - deletedDocs.count(), so i don't
> think it ever makes sese to iterate up to numDocs.
> 
> : I'm doing something akin to a rangeQuery, where I delete documents
> : within a certain range (in addition to other criteria). Is it better
> : to do a query on the range, mark all the docNums getting them with
> : Hits.id(), and then retrieve docs and test for deletion according to
> : that?
> 
> Take a look at the way RangeFilter.bits() is implimented.  if you
> cut/paste that code and replace the call to bits.set(termDocs.doc()); with
> reader.delete(termDocs.doc()) I think you've have exactly what you want.
> 
> Or, since cutting/pasting code is "A Bad Thing" from a maintenence/bug
> fixing standpoint, you could just call RangeFilter.bits(reader) yourself,
> and then iterate of the set bits and call delete on each one.

Perhaps an extra rewrite method with a term visitor argument?

Regards,
Paul Elschot

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to