Reputation: 3807
My data model:
Dress
|-kind
|-color
|-for_season
I want to search the model for a specific season as well as for all seasons, like as follows:
Search Query: all seasons
Should Match: Winter, Spring, Summer, Fall
I have the following line in my synonyms file:
all\s seasons: winter, spring, summer, fall
I am doing it query time and I see the solr admin panel analyze page showing the synonyms in the term column. However, when I search for for_season:all seasons
I don't get any result.
Any idea why? Appreciate your time on this.
Edit:
Here's what I found:
I had to escape the synonyms appearing on the right hand side, as follows:
all news => weather\ forecast, sports, ...
At query time, I had to wrap the query in double quotes. as follows:
my_field:"all news"
I had to put the original word on the RHS as it won't find that unless it was repeated.
news => news, weather\ forecast, sports, ...
It looks to be working fine now. Thanks for your time.
Upvotes: 1
Views: 2984
Reputation: 2073
Generally there is a problem with multi-term synonyms (e.g. 'all seasons') in Apache Solr. Description of this problem you can find here:
and here you can find a nice solution of this problem:
Upvotes: 0
Reputation: 8204
Space isn't a delimiter in the synonym configuration file. You shouldn't have to escape it.
Per documentation here: http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters#solr.SynonymFilterFactory
This should just be
all seasons => winter, spring, summer, fall
Upvotes: 2