SOLR synonyms return the query value

Viewed 28

I am trying to implement synonyms for some address searching and have managed to get them to work.

eg. CT is mapped to COURT and searching for CLARA CT returns results for CLARA COURT which is all good.

The issue that I am facing currently is that if I query for 5 CLARA CT, I still get CLARA CT (as the street numbers are not indexed, only the names).

Is it possible just to get the synoynm for the query (bypassing the indexed value) eg. if I query for 5 CLARA CT, I get back 5 CLARA COURT.

In the analyser I can see that for 5 CLARA CT the SynonymGraphFilter is converting it into 5 CLARA COURT.

Following is what I have in my schema...

<fieldType name="text_ws" class="solr.TextField" positionIncrementGap="100">
    <analyzer type="index">
      <tokenizer class="solr.StandardTokenizerFactory"/>
      <filter class="solr.SynonymGraphFilterFactory" synonyms="mysynonyms.txt"/>
      <filter class="solr.FlattenGraphFilterFactory"/> <!-- required on index analyzers after graph filters -->
    </analyzer>
    <analyzer type="query">
      <tokenizer class="solr.StandardTokenizerFactory"/>
      <filter class="solr.SynonymGraphFilterFactory" synonyms="mysynonyms.txt"/>
    </analyzer>
</fieldType>
0 Answers
Related