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

Renaud Delbru commented on LUCENE-4642:
---------------------------------------

Hi Robert,

I understand your point of view. One possible alternative for simplifying the 
API would be to refactor constructors with AttributeSource/AttributeFactory 
into setters. After a quick look, this looks compatible with the existing 
tokenizers and tokenizer factories. 
The setting of AttributeSource/AttributeFactory for a tokenizer will be 
transparent (i.e., they do not have to explicitly create a constructor), and 
specific extension can be still implemented by subclasses (e.g., 
NumericTokenStream can overwrite the setAttributeFactory method to wrap a given 
factory with NumericAttributeFactory).
For the tokenizer factories, we can then implement a create method with an 
AttributeSource/AttributeFactory parameter, which will call the abstract method 
create and then call the setAttributeSource/setAttributeFactory on the newly 
created tokenizer.

What do you think ? Did I miss something in my reasoning which could break 
something ? 
                
> TokenizerFactory should provide a create method with a given 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.2, 5.0
>
>         Attachments: LUCENE-4642.patch, LUCENE-4642.patch
>
>
> All tokenizer implementations have a constructor that takes a given 
> AttributeSource as parameter (LUCENE-1826). However, the TokenizerFactory 
> does not provide an API to create tokenizers with a given AttributeSource.
> Side note: There are still a lot of tokenizers that do not provide 
> constructors that take AttributeSource and AttributeFactory.

--
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: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to