Hi Mike, Thanks for the response,
Sounds like I was using it incorrectly by specifying the SynonymGraphFilter at query time AND SynonymGraphFilter followed by FlattenGraphFilter at index time. I need to specify one or the other. J.D. J.D. Corbin Senior Research Engineer Advanced Computing & Data Science Lab 3075 W. Ray Road Suite 200 Chandler, AZ 85226-2495 USA M: (303) 912-0958 E: jd.cor...@pearson.com Pearson Always Learning Learn more at www.pearson.com <http://www.pearsonk12.com/> On Mon, Feb 13, 2017 at 3:32 PM, Michael McCandless < luc...@mikemccandless.com> wrote: > Hi J.D., > > First you need to decide if it's OK to do all your syns at search > time. It results in slower queries, and different scoring, yet > correct multi-token results, vs. index time. > > If that is OK, then you should not use any syn filter at index time, > and use only SynonymGraphFilter at search time. > > If it is not OK, then you should use SynonymGraphFilter followed by > FlattenGraphFilter at index time, and no syn filter at search time. > > Mike McCandless > > http://blog.mikemccandless.com > > > On Mon, Feb 13, 2017 at 3:19 PM, Corbin, J.D. <jd.cor...@pearson.com> > wrote: > > Hi, > > > > I am looking for some guidance on the proper use of the > SynonymGraphFilter > > in Lucene (6.4.1). > > > > Below is how I am implementing the analyzers for the index and query > sides. > > I don't see a lot of examples on the proper usage of the > SynonymGraphFilter > > so was hoping that someone (Michael McCandless?) might be able to shed > some > > like on how to use this filter, both on the index and query side. > > > > I have defined a custom analyzer that I specify at index time, it > contains > > among other things, the following code block in the createComponents(): > > > > Note: getSynonyms() loads from Wordnet data > > > > SynonymMap synonyms = getSynonyms(); > > > > if (synonyms != null) { > > > > result = new SynonymGraphFilter(result, synonyms, true); > > > > result = new FlattenGraphFilter(result); // is this > > required when indexing? > > > > } > > > > > > ... and on the query side, my analyzer (createComponents), includes the > > following: > > > > > > SynonymMap synonyms = getSynonyms(); > > > > if (synonyms != null) > > > > { > > > > result = new SynonymGraphFilter(result, synonyms, true); > > > > // note: not flattening on the query side... is this correct > or > > should I flatten on both sides (e.g., use same analyzer for both index > and > > query) > > > > } > > > > > > J.D. Corbin >