lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael McCandless <luc...@mikemccandless.com>
Subject Re: Proper Use of SynonymGraphFilter
Date Mon, 13 Feb 2017 22:32:32 GMT
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.corbin@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

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message