[ 
https://issues.apache.org/jira/browse/LUCENE-8566?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16692515#comment-16692515
 ] 

Tomoko Uchida commented on LUCENE-8566:
---------------------------------------

Are there any feedbacks? :)

I will try to explain some background. (I'm not a fluent English speaker. 
Excuse me if I make mistakes.)
I have recently learned about the concept of Service Provider Interface and 
Java9's Module System utilizes this to decouple the interfaces and 
implementations (though it seems Lucene does not use the JDK's ServiceLoader 
but its own special loader class.) I did not know well about service providers 
until quite recently, but I like the essential concept and feel like that it's 
a good idea to limit the way to look up the factories, those are often provided 
from third party jars, only via names.

I think Lucene users and also Solr should use service names to instantiate the 
factories in the future, but first Lucene itself should use only the names and 
force to its users to use them. So I am considering this is a small step to 
unify the use of the factories.

Just for information, my studies and thoughts was staretd from a comment in 
this issue: https://issues.apache.org/jira/browse/LUCENE-8453

bq. We should also document the SPI name of each factory.


But I do not want to mess up the issue board (may be because of my lack of 
understanding for the details or priorities,) I will close this in a few weeks 
if there are no comments here.

 

> Deprecate methods in CustomAnalyzer.Builder which take factory classes
> ----------------------------------------------------------------------
>
>                 Key: LUCENE-8566
>                 URL: https://issues.apache.org/jira/browse/LUCENE-8566
>             Project: Lucene - Core
>          Issue Type: Improvement
>          Components: modules/analysis
>            Reporter: Tomoko Uchida
>            Priority: Minor
>
> CustomAnalyzer.Builder has methods which take implementation classes as 
> follows.
>  - withTokenizer(Class<? extends TokenizerFactory> factory, String... params)
>  - withTokenizer(Class<? extends TokenizerFactory> factory, 
> Map<String,String> params)
>  - addTokenFilter(Class<? extends TokenFilterFactory> factory, String... 
> params)
>  - addTokenFilter(Class<? extends TokenFilterFactory> factory, 
> Map<String,String> params)
>  - addCharFilter(Class<? extends CharFilterFactory> factory, String... params)
>  - addCharFilter(Class<? extends CharFilterFactory> factory, 
> Map<String,String> params)
> Since the builder also has methods which take service names, it seems like 
> that above methods are unnecessary and a little bit misleading. Giving 
> symbolic names is preferable to implementation factory classes, but for now, 
> users can write code depending on implementation classes.
> What do you think about deprecating those methods (adding {{@Deprecated}} 
> annotations) and deleting them in the future releases? Those are called by 
> only test cases so deleting them should have no impact on current lucene/solr 
> codebase.
> If this proposal gains your consent, I will create a patch. (Let me know if I 
> missed some point. I'll close it.)



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to