lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steve Rowe (JIRA)" <>
Subject [jira] [Commented] (LUCENE-4877) Fix analyzer factories to throw exception when arguments are invalid
Date Mon, 01 Apr 2013 10:11:15 GMT


Steve Rowe commented on LUCENE-4877:

Really nice de-cluttering in the tests.

I don't like the 4-arg required param getXXX() methods in AbstractAnalysisFactory - 4th param
as false means required??? - maybe these could be converted to getRequiredXXX() ?

I think AbstractAnalysisFactory could use additional param parsing methods:

* get(args, param [, default]) would be a nice addition for strings, instead of args.remove(),
which looks different from all the other getXXX() methods.  Maybe also a version that takes
a set of acceptable values, as well as a boolean for case insensitivity?
* getEnum(args, param, Enum class [, default] ) - probably case insensitivity could be assumed?
* getChar() should be pulled out of PathHierarchyTokenizerFactory, so that DelimitedPayloadTokenFilterFactory
can use it.
* getFloat() - well, only one factory (NumericPayloadTokenFilterFactory) could use it now,
but maybe add it for completeness?

A few nits:

* TestMappingCharFilterFactory's factory could switch to being instantiated using the charFilterFactory()
* EdgeNgramTokenizerFactory's gram size constants are pulled from EdgeNgramTokenFilter instead
of EdgeNgramTokenizer
* LimitTokenCountFilterFactory's maxTokenCount param should be required; this is a pre-existing
problem though
* PatternTokenizerFactory's group param should use the getInt() method with a default of -1.

I can do the work if you agree with these.
> Fix analyzer factories to throw exception when arguments are invalid
> --------------------------------------------------------------------
>                 Key: LUCENE-4877
>                 URL:
>             Project: Lucene - Core
>          Issue Type: Bug
>          Components: modules/analysis
>            Reporter: Robert Muir
>         Attachments: LUCENE-4877_one_solution_prototype.patch, LUCENE-4877.patch, LUCENE-4877.patch,
> Currently if someone typos an argument "someParamater=xyz" instead of someParameter=xyz,
they get no exception and sometimes incorrect behavior.
> It would be way better if these factories threw exception on unknown params, e.g. they
removed the args they used and checked they were empty at the end.

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:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message