I am trying to get synonyms working correctly, I want to map floor locker to storage locker
currently searching for storage locker produces results were as searching for floor locker does not produce any results.
I have the following setup for index time synonyms:
<fieldType name="text" class="solr.TextField" positionIncrementGap="100" omitNorms="false">
<analyzer type="index">
<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true" tokenizerFactory="KeywordTokenizerFactory"/>
<charFilter class="solr.HTMLStripCharFilterFactory"/>
<filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="0" />
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" />
<filter class="solr.EnglishPorterFilterFactory" protected="protwords.txt" />
<filter class="solr.LowerCaseFilterFactory" />
<filter class="solr.RemoveDuplicatesTokenFilterFactory" />
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
</analyzer>
......
And my synonyms.txt looks like this:
floor locker=>storage locker
What am I doing wrong?
You have the order of the analysis chain wrong. You should put the char filter first, then the tokenizer. The synonym filter can be immediately after that. The remainder of the filters are in the right order, or at least a good order.