Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-10102

SynonymFilterFactory in example file is on query not index



    • Bug
    • Status: Closed
    • Major
    • Resolution: Cannot Reproduce
    • 4.10.2, 6.4.1
    • None
    • examples
    • None


      The example files for both 4.10.2 and 6.4.1 have entries like these:

        <fieldType name="text_general" class="solr.TextField" positionIncrementGap="100" multiValued="true">
          <analyzer type="index">
            <tokenizer class="solr.StandardTokenizerFactory"/>
            <filter class="solr.StopFilterFactory" words="stopwords.txt" ignoreCase="true"/>
            <filter class="solr.LowerCaseFilterFactory"/>
          <analyzer type="query">
            <tokenizer class="solr.StandardTokenizerFactory"/>
            <filter class="solr.StopFilterFactory" words="stopwords.txt" ignoreCase="true"/>
            <!-- THIS IS WRONG, RIGHT? -->
            <filter class="solr.SynonymFilterFactory" expand="true" ignoreCase="true" synonyms="synonyms.txt"/>
            <filter class="solr.LowerCaseFilterFactory"/>

      You'll note that the synonym filter is applied at query time, which will totally fail. Even the docs say:

      The recommended approach for dealing with synonyms like this, is to expand the synonym when indexing.

      Can we fix this? Or is there a reason why this is like this? As I understand it, having synonyms on the query means that things just won't be returned that should be.

      For example, we have the token "5" set up with a synonym to the word "five". So, if somebody searches for 5, the query filter will expand it to "5 AND five", which, sure enough, the index doesn't match....no results. So...instead of expanding the result set, like synonyms are supposed to do, this actively contracts it.

      I hope my frustration in this is misplaced, but if I'm right about this bug, can I say that this is the kind of thing that makes Solr super frustrating to use?




            Unassigned Unassigned
            mlissner Mike Lissner
            0 Vote for this issue
            5 Start watching this issue