[
https://issues.apache.org/jira/browse/LUCENE-4642?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13600801#comment-13600801
]
Robert Muir commented on LUCENE-4642:
-------------------------------------
Its not a constructor explosion argument, because we aren't dealing with a
constructor.
Its just not a good API currently: it means every factory has to implement
create() twice.
Whats the sense in:
{code}
/** Creates the {@link TokenStream} of n-grams from the given {@link Reader}.
*/
@Override
public NGramTokenizer create(Reader input) {
return new NGramTokenizer(input, minGramSize, maxGramSize);
}
@Override
public NGramTokenizer create(AttributeFactory factory, Reader input) {
return new NGramTokenizer(factory, input, minGramSize, maxGramSize);
}
{code}
when you can just have
{code}
@Override
public NGramTokenizer create(AttributeFactory factory, Reader input) {
return new NGramTokenizer(factory, input, minGramSize, maxGramSize);
}
{code}
and in the base tokenizerfactory have
{code}
/** just for ease of use... maybe @deprecated, maybe don't even have this
method */
public final Tokenizer create(Reader input) {
return create(DEFAULT_ATTRIBUTE_FACTORY, input);
}
{code}
> Add create(AttributeFactory) to TokenizerFactory and subclasses with ctors
> taking AttributeFactory, and remove Tokenizer's and subclasses' ctors taking
> AttributeSource
> -----------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: LUCENE-4642
> URL: https://issues.apache.org/jira/browse/LUCENE-4642
> Project: Lucene - Core
> Issue Type: Improvement
> Components: modules/analysis
> Affects Versions: 4.1
> Reporter: Renaud Delbru
> Assignee: Steve Rowe
> Labels: analysis, attribute, tokenizer
> Fix For: 4.3
>
> Attachments: LUCENE-4642.patch, LUCENE-4642.patch, LUCENE-4642.patch,
> LUCENE-4642.patch, TrieTokenizerFactory.java.patch
>
>
> All tokenizer implementations have a constructor that takes a given
> AttributeSource as parameter (LUCENE-1826). These should be removed.
> TokenizerFactory does not provide an API to create tokenizers with a given
> AttributeFactory, but quite a few tokenizers have constructors that take an
> AttributeFactory. TokenizerFactory should add a create(AttributeFactory)
> method, as should subclasses for tokenizers with AttributeFactory accepting
> ctors.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]