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

Hoss Man updated SOLR-4813:
---------------------------

    Attachment: SOLR-4813.patch

Shingo: a flaw in your test was that "inform" was never called on the 
SynonymFilterFactory you were manually constructing, so it never attempted to 
instantiate your "TestTokenizerFactory", so all of the checks you had in it's 
constructor were being ignored.

I simplified the test to use tokenFilterFactory() to try and deal with this, 
but that exposed another problem: since your TestTokenizerFactory class isn't 
registered with SPI, "lookupClass()" fails on it.

To simplify all of this, I changed the test to us a real tokenizer factory with 
mandatory init arg (PatternTokenizerFactory), so we can check both the positive 
and negative cases -- this includes an explicit check that specifying params 
which neither the SynonymFilterFactor nor the tokenizerFactory are expecting 
causes an error.

I also tweaked your javadocs to try and clarify that the param prefix could be 
used even if the param names don't conflict, and re-ordered the param parsing 
code to group of of the tokenizerFactory stuff together.

still running full tests.


                
> Unavoidable IllegalArgumentException occurs when SynonymFilterFactory's 
> setting has tokenizer factory's parameter.
> ------------------------------------------------------------------------------------------------------------------
>
>                 Key: SOLR-4813
>                 URL: https://issues.apache.org/jira/browse/SOLR-4813
>             Project: Solr
>          Issue Type: Bug
>          Components: Schema and Analysis
>    Affects Versions: 4.3
>            Reporter: Shingo Sasaki
>            Assignee: Hoss Man
>            Priority: Critical
>              Labels: SynonymFilterFactory
>             Fix For: 5.0, 4.4, 4.3.1
>
>         Attachments: SOLR-4813.patch, SOLR-4813.patch
>
>
> When I write SynonymFilterFactory' setting in schema.xml as follows, ...
> {code:xml}
> <analyzer>
>   <tokenizer class="solr.NGramTokenizerFactory" maxGramSize="2" 
> minGramSize="2"/>
>   <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" 
> ignoreCase="true" expand="true"
>    tokenizerFactory="solr.NGramTokenizerFactory" maxGramSize="2" 
> minGramSize="2"/>
> </analyzer>
> {code}
> IllegalArgumentException ("Unknown parameters") occurs.
> {noformat}
> Caused by: java.lang.IllegalArgumentException: Unknown parameters: 
> {maxGramSize=2, minGramSize=2}
>       at 
> org.apache.lucene.analysis.synonym.FSTSynonymFilterFactory.<init>(FSTSynonymFilterFactory.java:71)
>       at 
> org.apache.lucene.analysis.synonym.SynonymFilterFactory.<init>(SynonymFilterFactory.java:50)
>       ... 28 more
> {noformat}
> However TokenizerFactory's params should be set to loadTokenizerFactory 
> method in [FST|Slow]SynonymFilterFactory. (ref. SOLR-2909)
> I think, the problem was caused by LUCENE-4877 ("Fix analyzer factories to 
> throw exception when arguments are invalid") and SOLR-3402 ("Parse Version 
> outside of Analysis Factories").

--
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