Unfortunately, Lucene's QueryParser pre-splits all incoming text on whitespace, which means your search-time analyzer never has a chance to detect the multi-word synonym. Ie, your analyzer is invoked twice. Once with "exercise" and once with "dvds".
We need to fix that... but it's not exactly clear how. The QueryParser/Analyzer interaction is tricky. Mike On Tue, Aug 3, 2010 at 12:34 PM, Qwerky <neil.j.tay...@hmv.co.uk> wrote: > > I'm having trouble getting multi word synonyms to work. As an example I have > the following synonym; > > exercise dvds => fitness > > When I search for exercise dvds I want to return all docs in the index which > contain the keyword fitness. I've read the wiki about > solr.SynonymFilterFactory which recommends expanding the synonym when > indexing, but I'm not sure this is what I want as none of my documents have > the keywords exercise dvds. > > Here is the field definition from my schema.xml; > > > > > > > > > > > > > > > > > > > > > > When I test my search with the analysis page on the admin console it seems > to work fine; > > Query Analyzer > org.apache.solr.analysis.WhitespaceTokenizerFactory {} > > > term position > 1 2 > > > term text > exercise dvds > > term type > word word > > source start,end > 0,8 9,13 > > > payload > > > org.apache.solr.analysis.SynonymFilterFactory {ignoreCase=true, > synonyms=synonyms.txt, expand=true} > > > term position > 1 > > term text > fitness > > > term type > word > > source start,end > 0,13 > > payload > > > org.apache.solr.analysis.TrimFilterFactory {} > > > > term position > 1 > > term text > fitness > > term type > word > > > source start,end > 0,13 > > payload > > > org.apache.solr.analysis.StopFilterFactory {ignoreCase=true, > enablePositionIncrements=true, words=stopwords.txt} > > > term position > 1 > > > term text > fitness > > term type > word > > source start,end > 0,13 > > payload > > > > org.apache.solr.analysis.LowerCaseFilterFactory {} > > > term position > 1 > > term text > fitness > > term type > > word > > source start,end > 0,13 > > payload > > > org.apache.solr.analysis.SnowballPorterFilterFactory {language=English, > protected=protwords.txt} > > > term position > > 1 > > term text > fit > > term type > word > > source start,end > 0,13 > > > payload > > > > ...but when I perform the search it doesn't seem to use the > SynonymFilterFactory; > > > > 0 > 0 > > exercise dvds > 0 > > on > > standard > > > 2.2 > standard > > on > *,score > 10 > > ..... > > exercise dvds > exercise dvds > PRODUCTKEYWORDS:exercis PRODUCTKEYWORDS:dvds > > PRODUCTKEYWORDS:exercis PRODUCTKEYWORDS:dvds > > > -- > View this message in context: > http://lucene.472066.n3.nabble.com/Multi-word-synomyms-tp1019722p1019722.html > Sent from the Solr - User mailing list archive at Nabble.com. >