To map `mairie` to `hotel de ville` as single token you must escape your white 
space.

mairie, hotel\ de\ ville

This results in  a problem if your tokenizer splits on white space at query 
time.

On Tuesday 10 April 2012 16:39:21 Erick Erickson wrote:
> Have you tried the "=>' mapping instead? Something
> like
> hotel de ville => mairie
> might work for you.
> 
> Best
> Erick
> 
> On Tue, Apr 10, 2012 at 1:41 AM, elisabeth benoit
> 
> <elisaelisael...@gmail.com> wrote:
> > Hello,
> > 
> > I've read several post on this issue, but can't find a real solution to
> > my multi-words synonyms matching problem.
> > 
> > I have in my synonyms.txt an entry like
> > 
> > mairie, hotel de ville
> > 
> > and my index time analyzer is configured as followed for synonyms.
> > 
> > <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt"
> > ignoreCase="true" expand="true"/>
> > 
> > The problem I have is that now "mairie" matches with "hotel" and I would
> > only want "mairie" to match with "hotel de ville" and "mairie".
> > 
> > When I look into the analyzer, I see that "mairie" is mapped into
> > "hotel", and words "de ville" are added in second and third position. To
> > change that, I tried to do
> > 
> > <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt"
> > ignoreCase="true" expand="true"
> > tokenizerFactory="solr.KeywordTokenizerFactory"/> (as I read in one post)
> > 
> > and I can see now in the analyzer that "mairie" is mapped to "hotel de
> > ville", but now when I have query "hotel de ville", it doesn't match at
> > all with "mairie".
> > 
> > Anyone has a clue of what I'm doing wrong?
> > 
> > I'm using Solr 3.4.
> > 
> > Thanks,
> > Elisabeth

-- 
Markus Jelsma - CTO - Openindex

Reply via email to