Biggest red flag is "KeywordTokenizerFactory". You don't
say whether your input is multi-word or not, but
that tokenizer does NOT break up input, so
even the input "my watche" would not trigger a
synonym substitution. Try something like
WhitespaceTokenizer.....

Second red flag. Changing your analysis chain
so radically between index and query is pretty
much guaranteed to mess you up. In your example,
all your input is reduced to "watch". But by not
having anything in your query side, "watche" will
not be matched. Either set expand="true" or
reduce the query-time matches as well.

Third red flag: Not having your ngram
stuff in place in the query is probably going
to keep your searches from matching as
you expect.

Anyway, hope that helps. If this isn't relevant, you
might post examples what actually doesn't work

Best
Erick

On Wed, Sep 28, 2011 at 12:12 PM, Doug McKenzie
<doug.mcken...@firebox.com> wrote:
> Trying to add in synonyms at index time but it's not working as expected.
> Here's the schema and example from synonyms.txt
>
> synonyms.txt has :
> watch, watches, watche, watchs
>
> schema for the field :
> <fieldType name="text_ngram" class="solr.TextField"
> positionIncrementGap="100">
> <analyzer type="index">
> <tokenizer class="solr.KeywordTokenizerFactory"/>
> <filter class="solr.LowerCaseFilterFactory"/>
> <filter class="solr.StopFilterFactory" ignoreCase="true"
> words="stopwords_en.txt" enablePositionIncrement="true"/>
> <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt"
> ignoreCase="true" expand="false"/>
> <filter class="solr.EdgeNGramFilterFactory" minGramSize="2" maxGramSize="15"
> side="front"/>
> </analyzer>
> <analyzer type="query">
> <tokenizer class="solr.KeywordTokenizerFactory"/>
> <filter class="solr.LowerCaseFilterFactory"/>
> </analyzer>
> </fieldType>
>
> When I run analysis, the index query correctly shows watche => watch, which
> is then EdgeNGrammed
>
> My understanding of how this is meant to work is that solr will index all
> instances of 'watche' as 'watch' when expand=false
>
> This doesn't seem to be happening though. Any ideas on what I'm missing?
>
> I initially set the synonym filtering to run at query time as its user input
> however that was returning the same results so I thought it might be because
> those terms were already in the index and would therefore show up in the
> results
>
> Thanks
> Doug
>
>
> --
> Become a Firebox Fan on Facebook: http://facebook.com/firebox
> And Follow us on Twitter: http://twitter.com/firebox
>
> Firebox has been nominated for Retailer of the Year in the 2011 Stuff
> Awards. Who will win? It's up to you! Visit http://www.stuff.tv/awards and
> place your vote. We'll do a special dance if it's us.
>
> Firebox HQ is MOVING HOUSE! We're migrating from Streatham Hill to  shiny
> new digs in Shoreditch. As of 3rd October please update your records to:
> Firebox.com, 6.10 The Tea Building, 56 Shoreditch High Street, London, E1
> 6JJ
>
> Global Head Office: Firebox House, Ardwell Road, London SW2 4RT
> Firebox.com Ltd is registered in England and Wales, company number 3874477
> Registered Company Address: 41 Welbeck Street London W1G 8EA Firebox.com
>
> Any views expressed in this email are those of the individual sender, except
> where the sender expressly, and with authority, states them to be the views
> of Firebox.com Ltd.
>

Reply via email to