lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Erick Erickson" <erickerick...@gmail.com>
Subject Re: next() not called in FilterIndexReader.FilterTermDocs
Date Mon, 11 Jun 2007 00:33:34 GMT
Wouldn't it be easier to just make a Filter? That's what they were
intended for.

Especially, if by "certain set", you mean that these are pre-defined
values, you could create your filters at start-up time and use
CachingWrapperFilter to keep them around.

Either way, I suspect it would be much simpler.

Best
Erick


On 6/10/07, lucene user <luz290@gmail.com> wrote:
>
> I am trying to use a Filter Index Reader to
> provide access only to the subset of my archive
> for which a certain field contains one of a given
> list of values.
>
> The idea is to create a special term for this field
> that means 'any term in the list', and add an 'AND'
> clause to every query, to enforce the condition.
>
> I override the seek() and next() methods of FilterTermDocs.
>
> In the seek(Term t) method I check if t is my special term.
> If it is, I initialize an instance variable in the FilterTermDocs,
> with an Iterator over my List. I then call super.seek(s) for
> a term 's' which has the same field name and a value which
> is the next element from the interator.
>
> In the next() method, If super.next() returns false,
> but the iterator is there and has a next element,
> I call super.seek(s) for the next element and try
> again.
>
> The problem is the although my seek() method is being called,
> my next() method is not. Thus I never get to iterate through
> my list, and only receive results corrasponding to its first
> element.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message