lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Uwe Schindler (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LUCENE-6958) Improve CustomAnalyzer to also allow to specify factory directly (for compile-time safety)
Date Mon, 04 Jan 2016 15:48:39 GMT

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

Uwe Schindler commented on LUCENE-6958:
---------------------------------------

bq. Looks good Uwe. Do you think we should delegate all the variants now to a private e.g.
withTokenizer(TokenizerFactory) which will also set components added, call applyResourceLoader
etc.?

Yes, would remove some code duplication, but that's a one-liner only. Will think about it.
CHANGES.txt will be added con commit.

Thanks for review.

> Improve CustomAnalyzer to also allow to specify factory directly (for compile-time safety)
> ------------------------------------------------------------------------------------------
>
>                 Key: LUCENE-6958
>                 URL: https://issues.apache.org/jira/browse/LUCENE-6958
>             Project: Lucene - Core
>          Issue Type: Improvement
>          Components: modules/analysis
>    Affects Versions: 5.4
>            Reporter: Uwe Schindler
>            Assignee: Uwe Schindler
>             Fix For: 5.5
>
>         Attachments: LUCENE-6958.patch
>
>
> Currently CustomAnalyzer only allows to specify the SPI names of factories. As the fluent
builder pattern is mostly used inside Java code, it is better for type safety to optionally
also specify the factory class directly (using compile-time safe patterns like {{.withTokenizer(WhitespaceTokenizerFactory.class)}}).
With the string names, you get the error only at runtime. Of course this does not help with
wrong, spelled parameter names, but it also has the side effect that you can click on the
class name in your code to get javadocs with the parameter names.
> This issue will add this functionality and update the docs/example.
> Thanks to [~shaie] for suggesting this!



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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


Mime
View raw message