You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Uwe Schindler (JIRA)" <ji...@apache.org> on 2014/03/30 12:12:15 UTC
[jira] [Comment Edited] (LUCENE-5559) Argument validation for
TokenFilters having numeric constructor parameter(s)
[ https://issues.apache.org/jira/browse/LUCENE-5559?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13954634#comment-13954634 ]
Uwe Schindler edited comment on LUCENE-5559 at 3/30/14 10:10 AM:
-----------------------------------------------------------------
Hi Achmet,
{noformat}
+ public void test() throws Exception {
+ MockTokenizer tokenizer = whitespaceMockTokenizer("A1 B2 C3 D4 E5 F6");
+ // LimitTokenCountFilter doesn't consume the entire stream that it wraps
+ tokenizer.setEnableChecks(false);
+ TokenStream stream = new LimitTokenCountFilter(tokenizer, 3);
+ assertTokenStreamContents(stream, new String[]{"A1", "B2", "C3"});
+ }
{noformat}
LimitTokenCount (and others like LimitPosition*) filter has the option to consume all tokens. Maybe better check this configuration, so the tokenizer can have checks enabled.
was (Author: thetaphi):
Hi Achmet,
{noformat}
+ public void test() throws Exception {
+ MockTokenizer tokenizer = whitespaceMockTokenizer("A1 B2 C3 D4 E5 F6");
+ // LimitTokenCountFilter doesn't consume the entire stream that it wraps
+ tokenizer.setEnableChecks(false);
+ TokenStream stream = new LimitTokenCountFilter(tokenizer, 3);
+ assertTokenStreamContents(stream, new String[]{"A1", "B2", "C3"});
+ }
{noformat}
LimitTokenCount (and others like LimitPosition*) filter has the option to consume all tokens. Maybe better check this configuration, s the tokenizer can have checks enabled.
> Argument validation for TokenFilters having numeric constructor parameter(s)
> ----------------------------------------------------------------------------
>
> Key: LUCENE-5559
> URL: https://issues.apache.org/jira/browse/LUCENE-5559
> Project: Lucene - Core
> Issue Type: Improvement
> Components: modules/analysis
> Affects Versions: 4.7
> Reporter: Ahmet Arslan
> Priority: Minor
> Fix For: 4.8
>
> Attachments: LUCENE-5559.patch, LUCENE-5559.patch, LUCENE-5559.patch
>
>
> Some TokenFilters have numeric arguments in their constructors. They should throw {{IllegalArgumentException}} for negative or meaningless values.
> Here is some examples that demonstrates invalid/meaningless arguments :
> {code:xml}
> <filter class="solr.LimitTokenCountFilterFactory" maxTokenCount="-10" />
> {code}
> {code:xml}
> <filter class="solr.LengthFilterFactory" min="-5" max="-1" />
> {code}
> {code:xml}
> <filter class="solr.LimitTokenPositionFilterFactory" maxTokenPosition="-3" />
> {code}
--
This message was sent by Atlassian JIRA
(v6.2#6252)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org