you are right, there is a interaction with the queryparser you should worry about too, as it break the query on whitespace and give no chance for a multi-word synonymfilter to do its job.
Take a look at this page: http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters#solr.SynonymFilterFactory You could try using Solr's SynonymFilter in your lucene application, following some of the guidelines there. On Sun, Feb 21, 2010 at 4:28 PM, Claudio R <[email protected]> wrote: > Hi Robert. > > The problem is the SynonymFilter to return a tokenStream with 2 words? > The queryParser can not handle it? > What can I do? > > --- Em sáb, 20/2/10, Robert Muir <[email protected]> escreveu: > > De: Robert Muir <[email protected]> > Assunto: Re: Problem when the synonym has 2 words > Para: [email protected] > Data: Sábado, 20 de Fevereiro de 2010, 23:22 > > Unfortunately, I am sad to say the lucene contrib SynonymFilter does not > yet > support multi-word synonyms > > On Sat, Feb 20, 2010 at 3:50 PM, Claudio R <[email protected]> wrote: > > > Hello. I have a document with the text: "Playstation 3". The search "ps3" > > should return this document. I created a SynonymTokenFilter based on code > > from Lucene contrib package. In my SynonymMap I have: > > > > map.put ( "ps3", new String [] ( "\" playstation 3 \ ""}); > > > > But that does not work. > > > > In my analyzer, I have: > > > > public final tokenStream tokenStream (String fieldName, Reader reader) ( > > TokenStream result = new StandardTokenizer (reader); > > result = new StandardFilter (result); > > result = new StopFilter (result, stoptable); > > result = new ISOLatin1AccentFilter (result); > > result = new LowerCaseFilter (result); > > result = new SynonymFilter (result, new SynonymEngineImpl (), 10000); > > return result; > > ) > > > > The SynonymTokenFilter works when the synonym has only 1 word. But when > the > > synonym is composed of 2 or more words, does not work. > > I am using the Lucene 2.4.1 (java version). > > Can anyone help me? > > > > > > > > > > > ____________________________________________________________________________________ > > Veja quais são os assuntos do momento no Yahoo! +Buscados > > http://br.maisbuscados.yahoo.com > > > > > > -- > Robert Muir > [email protected] > > > > > > ____________________________________________________________________________________ > Veja quais são os assuntos do momento no Yahoo! +Buscados > http://br.maisbuscados.yahoo.com > -- Robert Muir [email protected]
