Solr
  1. Solr
  2. SOLR-6211

TrieDateField doesn't default to omitNorms=true

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.9
    • Fix Version/s: 4.10, 6.0
    • Component/s: None
    • Labels:
      None

      Description

      In SOLR-3140, omitNorms=true was made the default for all primitive fields. But this is not the case for TrieDateField - if the fieldType config for a TrieDateField has no omitNorms set, the fields will have norms.

      It definitely looks like it was intended for TrieDateField to default to omitNorms=true, because in the example schema.xml, omitNorms=true was removed from tdate.

      I think TrieDateField.init() just needs to call super.init() to fix this. Right now it is initializing its wrapped field, but not itself.

      There were some changes around this in trunk in SOLR-5936, but I haven't tested to see if it's fixed there. It might have covered this bug up even further, as there is now a test in PrimitiveFieldTypeTest for this, but it uses the overridden TrieDateField.hasProperty() method, which is not the way that SchemaField actually accesses the field type properties.

      1. SOLR-6211-branch_4x.patch
        4 kB
        Steve Rowe
      2. SOLR-6211-trunk.patch
        2 kB
        Steve Rowe

        Issue Links

          Activity

          Hide
          Steve Rowe added a comment -

          +1

          This is only a problem on branch_4x, because on trunk, for SOLR-5936, I added the following to TrieDateField:

          @Override
          protected boolean hasProperty(int p) {
            return wrappedField.hasProperty(p);
          }
          

          I think the above should be added to branch_4x TrieDateField too, rather than calling super.init() from init().

          On trunk PrimitiveFieldTypeTest.testDefaultOmitNorms() explicitly tests that TrieDateField has the OMIT_NORMS property under schema version 1.5, but not on branch_4x - we should add all Trie fields to that test on both branch_4x and trunk.

          I'll work up a patch.

          Show
          Steve Rowe added a comment - +1 This is only a problem on branch_4x, because on trunk, for SOLR-5936 , I added the following to TrieDateField : @Override protected boolean hasProperty( int p) { return wrappedField.hasProperty(p); } I think the above should be added to branch_4x TrieDateField too, rather than calling super.init() from init() . On trunk PrimitiveFieldTypeTest.testDefaultOmitNorms() explicitly tests that TrieDateField has the OMIT_NORMS property under schema version 1.5, but not on branch_4x - we should add all Trie fields to that test on both branch_4x and trunk. I'll work up a patch.
          Hide
          Steve Rowe added a comment -

          branch_4x patch adds overridden TrieDateField.hasProperty() method, as mentioned in my previous comment. Also adds overridden TrieDateField.isMultiValued() method, which suffered the same problem (not forwarding calls to the wrapped implementation).

          Both patches add all Trie fields to PrimitiveFieldTypeTest.testDefaultOmitNorms().

          Committing shortly.

          Show
          Steve Rowe added a comment - branch_4x patch adds overridden TrieDateField.hasProperty() method, as mentioned in my previous comment. Also adds overridden TrieDateField.isMultiValued() method, which suffered the same problem (not forwarding calls to the wrapped implementation). Both patches add all Trie fields to PrimitiveFieldTypeTest.testDefaultOmitNorms() . Committing shortly.
          Hide
          ASF subversion and git services added a comment -

          Commit 1606734 from Steve Rowe in branch 'dev/trunk'
          [ https://svn.apache.org/r1606734 ]

          SOLR-6211: TrieDateField doesn't default to omitNorms=true.

          Show
          ASF subversion and git services added a comment - Commit 1606734 from Steve Rowe in branch 'dev/trunk' [ https://svn.apache.org/r1606734 ] SOLR-6211 : TrieDateField doesn't default to omitNorms=true.
          Hide
          ASF subversion and git services added a comment -

          Commit 1606741 from Steve Rowe in branch 'dev/branches/branch_4x'
          [ https://svn.apache.org/r1606741 ]

          SOLR-6211: TrieDateField doesn't default to omitNorms=true. (merged trunk r1606734)

          Show
          ASF subversion and git services added a comment - Commit 1606741 from Steve Rowe in branch 'dev/branches/branch_4x' [ https://svn.apache.org/r1606741 ] SOLR-6211 : TrieDateField doesn't default to omitNorms=true. (merged trunk r1606734)
          Hide
          Steve Rowe added a comment -

          Committed to trunk and branch_4x.

          Show
          Steve Rowe added a comment - Committed to trunk and branch_4x.

            People

            • Assignee:
              Steve Rowe
              Reporter:
              Michael Ryan
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development