lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeremy Volkman <jvolk...@gmail.com>
Subject Filtering documents out of IndexReader
Date Thu, 09 Apr 2009 23:02:55 GMT
Recently I found myself wanting an IndexReader to which I could say,
"pretend like documents x, y and z are deleted, but don't really delete
them." To do this, I extended FilterIndexReader and overrode TermDocs,
TermPositions and various other methods to run the results of the wrapped
reader past a BitVector containing doc ids to filter. The issue I ran into
is that with LUCENE-1483 searching bypasses the my overridden methods and
goes straight to the SegmentReaders after calling getSequentialSubReaders()
(which FilterIndexReader passes right through).

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.

-Jeremy

Mime
View raw message