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

Reply via email to