I am using the SynonymGraphFilter(SGF) in a custom analyzer (query side only) and when I print out the query generated from the QueryParser, it displays some clauses that I would like to understand. I am not sure I'm using the SGF properly.
Example Query output:(using Lucene 6.4.1) ..., (Synonym(title:cardiogram title:ecg title:ekg title:electrocardiogram) ... Graph(title:adobe title:brick, title:adobe, hasBoolean=true, hasPhrase=false) I'm curious if this is expected form when printing a query that uses the SynonymGraphFilter and what is the difference between the 'Synonym' and 'Graph' output when printing the query. The documentation on the filter suggest using TokenStreamToTermAutomatonQuery, but not sure in what context I should use it and how. My final query is built by using the BooleanQuery.Builder class which combines sub queries built using QueryParser. Here is how I am currently specifying the filter in my custom analyzer: TokenStreamComponents createComponents(String fieldName) { ... tokenizer, other filters, etc... SynonymMap synonyms = getSynonyms(); if (synonyms != null) { result = new SynonymGraphFilter(result, synonyms, true); } result = new StopFilter(result, stopwords); ...more filters return TokenStreamComponents(source, result); } J.D.