I have been using solr for a while but started running across situations
where synonyms are required.

the example I have is group of city names that look like "Fort Saint John"
(a city), in a text field.  Users may want to search for "Ft St John" or
"Fort St John" or "Ft Saint John" however

My attempted solution was to create a type that uses SynonymFilterFactory
and a text file of city based synonyms like this:

   saint,st,ste
   fort,ft

this doesnt work however and I am not sure I understand why.

any help appreciated.  thx

p.s. I am using Solr 4.6.1 and here is the field type definition from the
solrconfig.xml:

    <fieldtype name="geo_search_area_text" class="solr.TextField"
positionIncrementGap="100">
      <analyzer type="index">
        <tokenizer class="solr.PatternTokenizerFactory" pattern="[\^\-,|]"
group="-1" />
        <filter class="solr.LowerCaseFilterFactory"/>
        <filter class="solr.PatternReplaceFilterFactory" pattern="[^\w\s]"
replacement=" " replace="all" />
        <filter class="solr.PatternReplaceFilterFactory" pattern="[\s]{2,}"
replacement=" " replace="all" />
        <filter class="solr.TrimFilterFactory"/>
        <filter class="solr.SynonymFilterFactory"
synonyms="city_index_synonyms.txt" ignoreCase="true" expand="true" />
      </analyzer>
      <analyzer type="query">
        <tokenizer class="solr.PatternTokenizerFactory" pattern="[\^\-,|]"
group="-1" />
        <filter class="solr.LowerCaseFilterFactory"/>
        <filter class="solr.PatternReplaceFilterFactory" pattern="[^\w\s]"
replacement=" " replace="all" />
        <filter class="solr.PatternReplaceFilterFactory" pattern="[\s]{2,}"
replacement=" " replace="all" />
        <filter class="solr.TrimFilterFactory"/>
      </analyzer>
    </fieldtype>



--
View this message in context: 
http://lucene.472066.n3.nabble.com/how-do-I-get-search-for-fort-st-john-to-match-ft-saint-john-tp4127231.html
Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to