Mailing List Archive

Why is FuzzyQuery a final class?
Hi everyone,

I am new to Lucene, so this may have been asked before. But I could not find
an answer to my question in the archives, so I hope it is OK to ask it here.


I am trying to extend the FuzzyQuery to further filter the TermEnum. (I am
indexing stem forms and original forms, but I only want to match original
forms with a fuzzy term, otherwise I get to much noise). However, FuzzyQuery
is a final class and I cannot extend it. Could that be changed?

Thanks, Andreas.
Re: Why is FuzzyQuery a final class? [ In reply to ]
: forms with a fuzzy term, otherwise I get to much noise). However, FuzzyQuery
: is a final class and I cannot extend it. Could that be changed?

It's been final since the first rev ... i seem to recall some discussion
about many Lucene classes being final as a speed optimization in really
old JVMs, so it probably could be changed, but it would be a good idea to
audit the variables/methods in the class to make sure they would play nice
with subclasses (ie: no private methods that a subclass would likely need
to call, etc...)


that's not to say however that there isn't still a legitimate reason why
the class is final that i'm not realizing.

-Hoss


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org
Re: Why is FuzzyQuery a final class? [ In reply to ]
On 8/9/06, Chris Hostetter <hossman_lucene@fucit.org> wrote:

> old JVMs, so it probably could be changed, but it would be a good idea to
> audit the variables/methods in the class to make sure they would play nice
> with subclasses (ie: no private methods that a subclass would likely need
> to call, etc...)

Right, a subclass would probably like to see the minimumSimilarity and
prefixLength. They would be useful to redefine the enumerator.

Then there are also the inner classes ScoreTerm and ScoreTermQueue, used
by rewrite() to collect the most similar terms returned by the enumerator. If a
subclass wants to redefine rewrite(), they may be useful, and I don't
think it's
harmful to expose them.

> that's not to say however that there isn't still a legitimate reason why
> the class is final that i'm not realizing.

The class is fairly simple, and very similar to, for instance, WildcardQuery
(which is not final).

Andreas.

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