(12/03/03 1:39), Donald Organ wrote:
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?

Hi Donald,

Try to remove tokenizerFactory="KeywordTokenizerFactory" in your synonym filter
definition because I think you would want to tokenize the synonym settings in
synonyms.txt as "floor" / "locker" => "storage" / "locker". But if you set it
to KeywordTokenizer, it will be a map of "floor locker" => "storage locker", 
and as you
are using WhitespaceTokenizer for your <tokenizer/> in <analyzer/>, then if you
try to index "floor locker", it will be "floor"/"locker" (not "floor locker"),
as a result, it will not match to your synonym map.

Aside, I recommend that you would set <charFilter/> - <tokenizer/> - <filter/>
chain in the natural order in <analyzer/>, though if those are wrong it won't
be the cause of the problem at all.

koji
--
Query Log Visualizer for Apache Solr
http://soleami.com/

Reply via email to