You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Eric Schulte <es...@gmail.com> on 2005/12/28 03:18:13 UTC

filtering an IndexReader

Good evening everyone,

So, I apologize if this question has a simple answer (although I hope it
does). I am trying to apply a filter to an IndexReader, so that the reader
can only see documents that match the filter. The goal here is to be able to
implement the 'terms' and 'termDocs' methods, with the 'filter approved'
documents taken into consideration in putting together the stats.

I don't believe the FilterIndexReader class can do this (If it can I don't
know how).

Any ideas would be appreciated.

To anyone on the general lucene mailing list sorry about the cross-post.

Many Thanks,
Eric

Re: filtering an IndexReader

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On Dec 27, 2005, at 9:18 PM, Eric Schulte wrote:

> Good evening everyone,
>
> So, I apologize if this question has a simple answer (although I  
> hope it
> does). I am trying to apply a filter to an IndexReader, so that the  
> reader
> can only see documents that match the filter. The goal here is to  
> be able to
> implement the 'terms' and 'termDocs' methods, with the 'filter  
> approved'
> documents taken into consideration in putting together the stats.
>
> I don't believe the FilterIndexReader class can do this (If it can  
> I don't
> know how).
>
> Any ideas would be appreciated.
>
> To anyone on the general lucene mailing list sorry about the cross- 
> post.

Eric,

I've not done something like this myself, but I did a quick perusal  
of the source code and tracked it into how it is used.  There are a  
few subclasses of FilterIndexReader out there.  To do anything useful  
with FilterIndexReader you must subclass it and provide your own  
"filtering".

TestFilterIndexReader has some clues that might help you:

	<http://svn.apache.org/viewcvs.cgi/lucene/java/trunk/src/test/org/ 
apache/lucene/index/TestFilterIndexReader.java?view=markup>

I'm definitely interested in seeing how to go about implementing what  
you're after, so keep us posted.

	Erik


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