[ 
https://issues.apache.org/jira/browse/LUCENE-4642?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Steve Rowe updated LUCENE-4642:
-------------------------------

    Attachment: 
LUCENE-4642-single-create-method-on-TokenizerFactory-subclasses.patch

{quote}
bq. In this patch there is a new even more horrible hack in 
TrieTokenizer(Factory) - the AttributeFactory argument to the TrieTokenizer 
constructor is ignored!!! Surely there a better way???:
Just at a quick glance, I think it should be passed to 
TrieTokenizer.getNumericTokenStream(int), which should instead take 
(AttFactory, int), and call: public NumericTokenStream(AttributeFactory 
factory, final int precisionStep) ?
This way the numerictokenstream is created with the requested attfactory. 
TrieTokenizer shouldnt take factory at all since its just this 'layer on top' 
that pretends to be a tokenizer over it?
{quote}

Cool, that works, thanks; patch attached that does this.

Committing shortly.

                
> 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, 
> LUCENE-4642-single-create-method-on-TokenizerFactory-subclasses.patch, 
> LUCENE-4642-single-create-method-on-TokenizerFactory-subclasses.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: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to