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

Uwe Schindler edited comment on SOLR-8460 at 12/23/15 4:08 PM:
---------------------------------------------------------------

Can you provide an example TokenStream, For me it always works. The whole thing 
is buggy, I agree, but it should work with correctly implemented TokenStreams.

The most important thing: You have to implement the {{reflectWith()}} 
functionality correctly.

bq. Calling getAttribute (instead of addAttribute) in a TokenFilter constructor 
wouldn't find an attribute added by the input TokenStream.

Thats a bug in your TokenStream! getAttribute is only available for TokenStream 
consumers that don't want to add attributes they don't need. Producer code must 
always use addAttribute().

bq. Custom implementations of standard Attributes (e.g. FlagsAttribute) would 
trigger an exception.

If you use an AttributeFactory it should work correctly. In any case we should 
check that the ListBasedTokenStream uses the same attribute factory as the 
original tokenstream. This could be the bug here. Because it needs to clone the 
atttibutes and this fails if the original and the ListBasedTokenSteam uses 
different factories.


was (Author: thetaphi):
Can you provide an example TokenStream, For me it always works. The whole thing 
is buggy, I agree, but it should work with TokenStreams.

The most important thing: You have to implement the {{reflectWith()}} 
functionality correctly.

bq. Calling getAttribute (instead of addAttribute) in a TokenFilter constructor 
wouldn't find an attribute added by the input TokenStream.

Thats a bug in your TokenStream! getAttribute is only available for TokenStream 
consumers that don't want to add attributes they don't need. Producer code must 
always use addAttribute().

bq. Custom implementations of standard Attributes (e.g. FlagsAttribute) would 
trigger an exception.

If you use an AttributeFactory it should work correctly. In any case we should 
check that the ListBasedTokenStream uses the same attribute factory as the 
original tokenstream. This could be the bug here. Because it needs to clone the 
atttibutes and this fails if the original and the ListBasedTokenSteam uses 
different factories.

> /analysis/field doesn't always handle custom attributes correctly
> -----------------------------------------------------------------
>
>                 Key: SOLR-8460
>                 URL: https://issues.apache.org/jira/browse/SOLR-8460
>             Project: Solr
>          Issue Type: Bug
>          Components: Schema and Analysis
>            Reporter: David Smiley
>            Assignee: David Smiley
>            Priority: Minor
>             Fix For: 5.5
>
>         Attachments: SOLR_8460.patch
>
>
> I've got some custom analysis Attribute implementations in my analysis chain 
> with some other custom analysis components.  I found that Solr's Analysis 
> utility screen, powered by /field/analysis (FieldAnalysisRequestHandler 
> subclassing AnalysisRequestHandlerBase) gave me exceptions for two reasons, 
> both having to do with AnalysisRequestHandlerBase.ListBasedTokenStream:
> * Custom implementations of standard Attributes (e.g. FlagsAttribute) would 
> trigger an exception.
> * Calling getAttribute (instead of addAttribute) in a TokenFilter constructor 
> wouldn't find an attribute added by the input TokenStream.



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

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

Reply via email to