lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexandre Rafalovitch <arafa...@gmail.com>
Subject Re: Configuring a custom Analyzer for the SynonymFilter
Date Tue, 27 Sep 2016 14:22:57 GMT
Looking at the code (on GitHub is easiest), it can take either
analyzer or tokenizer but definitely not any chain definitions. This
seems to be the same all the way to 6.2.1.

Regards,
   Alex.
----
Newsletter and resources for Solr beginners and intermediates:
http://www.solr-start.com/


On 27 September 2016 at 21:10, Raf <r.ventaglio@gmail.com> wrote:
> Hi,
> is it possible to configure a custom analysis for synonyms the same way we
> do for index/query field analysis?
>
> Reading the *SynonymFilter* documentation[0], I have found I can specify a
> custom analyzer by writing its class name.
>
> Example:
> <fieldType name="myField_it" class="solr.TextField" >
>       <analyzer>
>         <tokenizer class="MyTokenizer" />
>         <filter class="solr.LowerCaseFilterFactory"/>
>         <filter class="MyFilter_1" />
>         <filter class="MyFilter_2" />
>         <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt"
> ignoreCase="true" expand="true"
> analyzer="org.apache.lucene.analysis.it.ItalianAnalyzer"/>
>       </analyzer>
>     </fieldType>
>
>
> What I would like to achieve, instead, it is something like this:
> <fieldType name="myField_it" class="solr.TextField">
>       <analyzer>
>         <tokenizer class="MyTokenizer" />
>         <filter class="solr.LowerCaseFilterFactory"/>
>         <filter class="MyFilter_1" />
>         <filter class="MyFilter_2" />
>         <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt"
> ignoreCase="true" expand="true">
>   <analyzer>
>               <tokenizer class="MyTokenizer" />
>               <filter class="solr.LowerCaseFilterFactory"/>
>               <filter class="MyFilter_1" />
>             </analyzer>
> </filter>
>       </analyzer>
>     </fieldType>
>
>
> I have tried to configure it this way, but it does not work.
> I do not get any configuration error, but the custom analyzer is not
> applied to synonyms.
>
> Is it possible to achieve this result by configuration or am I forced to
> write a custom Analyzer class?
>
> I am currently using Solr 5.2.1.
> At the moment I cannot upgrade to a newer version.
>
>
> Thank you very much for any help you can provide.
>
> Regards,
> *Raf*
>
>
> [0]
> http://archive.apache.org/dist/lucene/solr/ref-guide/apache-solr-ref-guide-5.2.pdf
>   p. 132

Mime
View raw message