You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Daniel Naber <lu...@danielnaber.de> on 2005/07/19 21:58:07 UTC

Analyzer as an Interface?

Hi,

currently Analyzer is an abstract class. Shouldn't we make it an Interface? 
Currently that's not possible, but it will be as soon as the deprecated 
method is removed (i.e. after Lucene 1.9).

Regards
 Daniel

-- 
http://www.danielnaber.de

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


Re: Analyzer as an Interface?

Posted by Daniel Naber <lu...@danielnaber.de>.
On Tuesday 19 July 2005 22:11, Wolfgang Hoschek wrote:

> Daniel, what's the use case that would make this a significant  
> improvement over extending and overriding the single abstract method?  
> Classes that implement multiple interfaces? 

Yes, exactly.

> thoughts would apply to TokenStream, IndexReader/Writer, etc. Also  
> note that once it's become an interface the API is effectively frozen  
> forever.

Well, not forever, but any change will lead to an incompatible API, that's 
an important point. One could however provide an abstract class 
"AbstractAnalyzer" which implements the interface and which can be 
extended by those who don't need the Lucene analyzer to be an interface. 
Those people wouldn't be affected by changes then (at least not more than 
they are now).

Regards
 Daniel

-- 
http://www.danielnaber.de

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


Re: Analyzer as an Interface?

Posted by Chris Collins <ch...@yahoo.com>.
I think there is a cost involved with this too isnt there?  I believe there is
an extra type check that has to be performed at runtime with interfaces that
would make it a tad slower.  Since these types of entities are sitting in tight
loops it may have a negative effect on performance.

--- Wolfgang Hoschek <wh...@lbl.gov> wrote:

> On Jul 19, 2005, at 12:58 PM, Daniel Naber wrote:
> 
> > Hi,
> >
> > currently Analyzer is an abstract class. Shouldn't we make it an  
> > Interface?
> > Currently that's not possible, but it will be as soon as the  
> > deprecated
> > method is removed (i.e. after Lucene 1.9).
> >
> > Regards
> >  Daniel
> >
> 
> Daniel, what's the use case that would make this a significant  
> improvement over extending and overriding the single abstract method?  
> Classes that implement multiple interfaces? For consistency, similar  
> thoughts would apply to TokenStream, IndexReader/Writer, etc. Also  
> note that once it's become an interface the API is effectively frozen  
> forever. With abstract classes the option remains open to later add  
> methods with a default impl. (e.g. tokenStream(String fieldName,  
> String text) or whatever).
> 
> Thanks,
> Wolfgang.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-dev-help@lucene.apache.org
> 
> 




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


Re: Analyzer as an Interface?

Posted by Wolfgang Hoschek <wh...@lbl.gov>.
On Jul 19, 2005, at 12:58 PM, Daniel Naber wrote:

> Hi,
>
> currently Analyzer is an abstract class. Shouldn't we make it an  
> Interface?
> Currently that's not possible, but it will be as soon as the  
> deprecated
> method is removed (i.e. after Lucene 1.9).
>
> Regards
>  Daniel
>

Daniel, what's the use case that would make this a significant  
improvement over extending and overriding the single abstract method?  
Classes that implement multiple interfaces? For consistency, similar  
thoughts would apply to TokenStream, IndexReader/Writer, etc. Also  
note that once it's become an interface the API is effectively frozen  
forever. With abstract classes the option remains open to later add  
methods with a default impl. (e.g. tokenStream(String fieldName,  
String text) or whatever).

Thanks,
Wolfgang.

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