Solr
  1. Solr
  2. SOLR-8329

SchemaSimilarityFactory should support a config option for the defaultSimilarity

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.4, 6.0
    • Component/s: None
    • Labels:
      None

      Description

      SchemaSimilarityFactory has an implicit default Similarity instance that it uses for any fieldTypes that don't define their own – we should make this default configurable.


      Example of how to use this new option from the javadocs...

         <similarity class="solr.SchemaSimilarityFactory" >
           <str name="defaultSimFromFieldType">type-using-custom-dfr</str>
         </similarity>
         ...
         <fieldType name="type-using-custom-dfr" class="solr.TextField">
           ...
           <similarity class="solr.DFRSimilarityFactory">
             <str name="basicModel">I(F)</str>
             <str name="afterEffect">B</str>
             <str name="normalization">H3</str>
             <float name="mu">900</float>
           </similarity>
         </fieldType>
       

        Issue Links

          Activity

          Hide
          Hoss Man added a comment -

          Attaching my proposal.

          Rather then trying to make SchemaSimilarityFactory configurable with both a factory name and optional configuration, this approach takes in a single fieldType name, and uses the similarity configured for that fieldtype as the default. (with error checking to ensure it has an explicit similarity configured.

          Show
          Hoss Man added a comment - Attaching my proposal. Rather then trying to make SchemaSimilarityFactory configurable with both a factory name and optional configuration, this approach takes in a single fieldType name, and uses the similarity configured for that fieldtype as the default. (with error checking to ensure it has an explicit similarity configured.
          Hide
          ASF subversion and git services added a comment -

          Commit 1715881 from hossman@apache.org in branch 'dev/trunk'
          [ https://svn.apache.org/r1715881 ]

          SOLR-8329: SchemaSimilarityFactory now supports a 'defaultSimFromFieldType' init option for using a fieldType name to identify which Similarity to use as a default

          Show
          ASF subversion and git services added a comment - Commit 1715881 from hossman@apache.org in branch 'dev/trunk' [ https://svn.apache.org/r1715881 ] SOLR-8329 : SchemaSimilarityFactory now supports a 'defaultSimFromFieldType' init option for using a fieldType name to identify which Similarity to use as a default
          Hide
          ASF subversion and git services added a comment -

          Commit 1715945 from hossman@apache.org in branch 'dev/branches/branch_5x'
          [ https://svn.apache.org/r1715945 ]

          SOLR-8329: SchemaSimilarityFactory now supports a 'defaultSimFromFieldType' init option for using a fieldType name to identify which Similarity to use as a default (merge r1715881)

          Show
          ASF subversion and git services added a comment - Commit 1715945 from hossman@apache.org in branch 'dev/branches/branch_5x' [ https://svn.apache.org/r1715945 ] SOLR-8329 : SchemaSimilarityFactory now supports a 'defaultSimFromFieldType' init option for using a fieldType name to identify which Similarity to use as a default (merge r1715881)
          Hide
          ASF subversion and git services added a comment -

          Commit 1715950 from hossman@apache.org in branch 'dev/trunk'
          [ https://svn.apache.org/r1715950 ]

          SOLR-8261 + SOLR-8329 + SOLR-8239: update 6.0 upgrade instructions to note new defaultSimFromFieldType option for people who want backcompat behavior even if luceneMatchVersion is increased. Also fixed some typos

          Show
          ASF subversion and git services added a comment - Commit 1715950 from hossman@apache.org in branch 'dev/trunk' [ https://svn.apache.org/r1715950 ] SOLR-8261 + SOLR-8329 + SOLR-8239 : update 6.0 upgrade instructions to note new defaultSimFromFieldType option for people who want backcompat behavior even if luceneMatchVersion is increased. Also fixed some typos

            People

            • Assignee:
              Hoss Man
              Reporter:
              Hoss Man
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development