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

Managed synonym lists do not include the original term in the expand

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 5.5
    • Fix Version/s: 5.5.1
    • Component/s: Schema and Analysis
    • Labels:
      None

      Description

      Spinoff from discussion in solr-user list http://find.searchhub.org/document/8dfce8a277de0f2a

      The managed synonyms filter does not behave the same way as the original synonym filter when a list is added. The original synonyms filter with default expand=true produces the following map when parsing a line:

      Input:

        a, b, c
      

      Becomes:

        a => a, b, c
        b => a, b, c
        c => a, b, c
      

      But the managed filter excludes the original term in the mapping, so an input ["a", "b", "c"] becomes:

        a => b, c
        b => a, c
        c => a, b
      

      This can also be seen in TestManagedSynonymFilterFactory.java where it is tested explicitly, while the tests for the file based synonymfilter expect an all-way expand including the original term.

      This causes a query for "a" to not match documents with the term "a", but only those with term "b" or "c".

      The offending line in ManagedSynonymFilterFactory is this

      188:   treeTerms.remove(origTerm);
      
      1. SOLR-8737.patch
        3 kB
        Jan Høydahl

        Issue Links

          Activity

          Hide
          janhoy Jan Høydahl added a comment -

          Any comment Timothy Potter? In SOLR-6878 there is a discussion about how this should work, but somewhere along the way something went wrong..

          Show
          janhoy Jan Høydahl added a comment - Any comment Timothy Potter ? In SOLR-6878 there is a discussion about how this should work, but somewhere along the way something went wrong..
          Hide
          janhoy Jan Høydahl added a comment -

          Trivial patch with updated tests which pass.

          Show
          janhoy Jan Høydahl added a comment - Trivial patch with updated tests which pass.
          Hide
          janhoy Jan Høydahl added a comment -

          Hints from mailing list that people have had issues with current behavior:
          http://find.searchhub.org/document/bd969ff7efacf642
          http://find.searchhub.org/document/8dfce8a277de0f2a

          Show
          janhoy Jan Høydahl added a comment - Hints from mailing list that people have had issues with current behavior: http://find.searchhub.org/document/bd969ff7efacf642 http://find.searchhub.org/document/8dfce8a277de0f2a
          Hide
          thelabdude Timothy Potter added a comment -

          Thanks for fixing Jan Høydahl. As a work-around until this is released, users can send in the mappings as a map, i.e.

          curl -v -X PUT \
            -H 'Content-type:application/json' \
            --data-binary '{ "a": ["a","b","c"], "b": ["a","b","c"], "c":["a","b","c"]}' \
            'http://localhost:8983/solr/techproducts/schema/analysis/synonyms/english'
          
          Show
          thelabdude Timothy Potter added a comment - Thanks for fixing Jan Høydahl . As a work-around until this is released, users can send in the mappings as a map, i.e. curl -v -X PUT \ -H 'Content-type:application/json' \ --data-binary '{ "a" : [ "a" , "b" , "c" ], "b" : [ "a" , "b" , "c" ], "c" :[ "a" , "b" , "c" ]}' \ 'http: //localhost:8983/solr/techproducts/schema/analysis/synonyms/english'
          Hide
          janhoy Jan Høydahl added a comment -

          Committed to branch_5_5 (133b6cdb838bb1261652e469936f7aeab133e9f0) and master (9bb9b7900faaaa0418517d1966cc26dc22df9c27)

          Show
          janhoy Jan Høydahl added a comment - Committed to branch_5_5 (133b6cdb838bb1261652e469936f7aeab133e9f0) and master (9bb9b7900faaaa0418517d1966cc26dc22df9c27)
          Hide
          janhoy Jan Høydahl added a comment -

          Resolving. Note that this is not ported to branch_5x

          Show
          janhoy Jan Høydahl added a comment - Resolving. Note that this is not ported to branch_5x
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit c7214a2ba5f96492e5c4cd6a558734217afe5089 in lucene-solr's branch refs/heads/branch_5_5 from Christine Poerschke
          [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=c7214a2 ]

          Merge 5.5.1 changes sections from SOLR-8737 and SOLR-8734 tickets.

          Show
          jira-bot ASF subversion and git services added a comment - Commit c7214a2ba5f96492e5c4cd6a558734217afe5089 in lucene-solr's branch refs/heads/branch_5_5 from Christine Poerschke [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=c7214a2 ] Merge 5.5.1 changes sections from SOLR-8737 and SOLR-8734 tickets.

            People

            • Assignee:
              janhoy Jan Høydahl
              Reporter:
              janhoy Jan Høydahl
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development