With the current API of TokenStream (incrementToken) I really do not see
how I could do the following scenario with the Decorator Pattern :
I have a case where I would like to execute the LowerCaseFilter only if
the token is of type "word". I do not want to execute the
LowerCaseFilter if the token is of type "number" for example.
Unfortunately, I don't see how this is possible using the current API
and the fact that the filters are final.
The only thing I can do is add a filter before the LowerCaseFilter that
would pass all the non-word tokens to the next filter, but it seems
really complicated for a case where a simple extend would do the job.
Or, if the API had two methods, one which increments the stream and
another which process the current "token" or attributes then it would be
possible to do what I have in mind using the Decorator Pattern.
Does anyone else see a way of doing this that is simple?
Daniel Shane
Uwe Schindler wrote:
See https://issues.apache.org/jira/browse/LUCENE-1753
In general, if you want to add functionality plug another filter into the
chain. At least the implementations should be final (next/incrementToken).
-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: u...@thetaphi.de
-----Original Message-----
From: Daniel Shane [mailto:sha...@lexum.umontreal.ca]
Sent: Thursday, September 10, 2009 4:06 PM
To: java-dev@lucene.apache.org
Subject: LowerCaseFilter, is there a reason why the class is final?
Hi all,
I was wondering why the LowerCaseFilter is declared final? In my code, I
would like to extend it but apparently its not possible. I'm just
wondering why extending this type of class is considered evil?
Daniel Shane
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-dev-h...@lucene.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-dev-h...@lucene.apache.org