You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Michael McCandless <lu...@mikemccandless.com> on 2008/07/01 14:40:37 UTC

Re: Should TokenFilter implement reset()

I think this makes sense.  Shai, could you open an issue & attach a  
patch?  Thanks.

Mike

Shai Erera wrote:

> Hi
>
> I was wondering if TokenFilter should implement reset(). The reason  
> is it maintains an internal TokenStream instance, however never  
> reset() that instance.
>
> I'm using Lucene 2.3.0, and I have a set of TokenFilters which wrap  
> each other (i.e. TF1(TF2(TF3)))). Each extends TokenFilter() and  
> implements reset(). As part of the implementation it calls  
> super.reset(). However, that super.reset() goes to  
> TokenStream.reset() which does nothing, therefore my TokenFilter  
> extensions' reset() never gets called.
>
> I implemented reset() in TokenFilter like that, and it solved my  
> problem. Is this the right approach? Am I using an old version of  
> Lucene?
>
>   public void reset() throws IOException {
>     super.reset();
>     input.reset();
>   }
>
> Thanks,
> Shai


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


Re: Should TokenFilter implement reset()

Posted by Shai Erera <se...@gmail.com>.
Done. Thanks !

On Tue, Jul 1, 2008 at 3:40 PM, Michael McCandless <
lucene@mikemccandless.com> wrote:

>
> I think this makes sense.  Shai, could you open an issue & attach a patch?
>  Thanks.
>
> Mike
>
>
> Shai Erera wrote:
>
>  Hi
>>
>> I was wondering if TokenFilter should implement reset(). The reason is it
>> maintains an internal TokenStream instance, however never reset() that
>> instance.
>>
>> I'm using Lucene 2.3.0, and I have a set of TokenFilters which wrap each
>> other (i.e. TF1(TF2(TF3)))). Each extends TokenFilter() and implements
>> reset(). As part of the implementation it calls super.reset(). However, that
>> super.reset() goes to TokenStream.reset() which does nothing, therefore my
>> TokenFilter extensions' reset() never gets called.
>>
>> I implemented reset() in TokenFilter like that, and it solved my problem.
>> Is this the right approach? Am I using an old version of Lucene?
>>
>>  public void reset() throws IOException {
>>    super.reset();
>>    input.reset();
>>  }
>>
>> Thanks,
>> Shai
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-dev-help@lucene.apache.org
>
>


-- 
Regards,

Shai Erera