lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael McCandless <luc...@mikemccandless.com>
Subject Re: Filtering documents out of IndexReader
Date Fri, 10 Apr 2009 00:01:52 GMT
On Thu, Apr 9, 2009 at 7:02 PM, Jeremy Volkman <jvolkman@gmail.com> wrote:

> I'm sure I can extend my wrapping reader to also wrap whatever is returned
> by getSequentialSubReaders, however all of what I'm writing is already done
> by IndexReader with respect to deletions. What if, instead of throwing
> UnsupportedOperationExceptions, a read-only IndexReader did everything it
> normally does with deletes up to the point of actually writing the .del
> file. This would allow documents to be removed from the reader for the
> lifetime of the reader, and seems like it might be a minimal change.

Well... readOnly IR relies on its deletedDocs never being changed, to
allow isDeleted to be unsynchronized.

Is this only for searching?  Could you just use a Filter with your search?

Or... you could make silly FSDirectory extension that pretends to
write outputs but never does, and pass it to IR.open?

Or maybe we should open up a way to discard pending changes in an IR
(like IW.rollback).

Or, with near real-time search (in trunk) you could 1) open IW with
autoCommit=false, 2) make your pretend deletes, 3) get a near
real-time reader from the IW (IW.getReader()), 4) do stuff with that
reader, 5) call IW.rollback() to discard your changes when done, and
close the reader.

One drawback with using deletes "temporarily" (as your filter) is you
won't be able to do any real deletes.

Mike
Mike

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


Mime
View raw message