On Tue, Sep 27, 2016 at 4:22 PM, Alexandre Rafalovitch <arafa...@gmail.com> wrote:
> 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. > Thanks for your answer Alex. Does anyone know if it exists a viable alternative to make it configurable inside the schema.xml instead of defining a custom Java class? I was thinking about something like: * defining the *analyzer* outside of the *field* element, giving it a name: <analyzer name="myAnalyzer"> <tokenizer class="MyTokenizer" /> <filter class="solr.LowerCaseFilterFactory"/> <filter class="MyFilter_1" /> </analyzer> * referring to it inside the *SynonymFilter* definition by its name: <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true" analyzer="myAnalyzer"/> Unfortunately I have not found anything like this inside the Solr documentation. Is it possible to achieve something like that or the only solution is writing a custom Java class for each combination filter I need to use for synonyms analysis? Thanks. Bye, *Raffaella* ---- > Newsletter and resources for Solr beginners and intermediates: > http://www.solr-start.com/ > > > On 27 September 2016 at 21:10, Raf <r.ventag...@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 >