You need only one FlattenGraphFilter at the end of your analysis chain. But note that neither SynonymGraphFilter nor SynonymFilter can consume a graph as input; so multiple SynonymGraphFilters will not work.
http://blog.mikemccandless.com/2012/04/lucenes-tokenstreams-are-actually.html gives some insight into why synonym filters create graphs, but it was written before SynonymGraphFilter and FlattenGraphFilter. Mike McCandless http://blog.mikemccandless.com On Wed, Oct 25, 2017 at 5:04 AM, Vincenzo D'Amore <v.dam...@gmail.com> wrote: > Hi all, > > I see in Solr SynonymFilterFactory is deprecated > > https://lucene.apache.org/core/7_1_0/analyzers-common/ > org/apache/lucene/analysis/synonym/SynonymFilterFactory.html > > the documentation suggest: > > Use SynonymGraphFilterFactory > > <https://lucene.apache.org/core/7_1_0/analyzers-common/ > org/apache/lucene/analysis/synonym/SynonymGraphFilterFactory.html> > > instead, but be sure to also use FlattenGraphFilterFactory > > <https://lucene.apache.org/core/7_1_0/analyzers-common/ > org/apache/lucene/analysis/core/FlattenGraphFilterFactory.html> > > at index time (not at search time) as well. > > > On the other hand documentation also say FlattenGraphFilterFactory is > experimental and might change in incompatible ways in the next release. > > Not sure what to do in this case. Not clear what does > FlattenGraphFilterFactory and why should I have it after the > SynonymGraphFilterFactory. > > And again, if I have many SynonymGraphFilterFactory at index time, may I > have only one FlattenGraphFilterFactory at end of chain or should I add a > FlattenGraphFilterFactory for each SynonymGraphFilterFactory found in the > chain? > > Thanks for your time and best regards, > Vincenzo >