Solr
  1. Solr
  2. SOLR-6682

EnumField + StatsComponent gives bad toString() for min/max, probably doesn't work in distributed search ... definitely needs more tests

    Details

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

      Description

      when EnumField was added, support was included in StatsComponent for it (via the EnumStatsValues) but it doesn't seem to have ever had any tests written for it.

      doing some quick manual testing, it seems like the min/max values just wind up being the "toString()" value of the EnumFieldValue, so you get a response like this...

      <lst name="stats">
        <lst name="stats_fields">
          <lst name="hoss">
            <str name="min">org.apache.solr.common.EnumFieldValue:Low</str>
            <str name="max">org.apache.solr.common.EnumFieldValue:High</str>
            <long name="count">2</long>
            <long name="missing">0</long>
            <lst name="facets"/></lst>
          </lst>
        </lst>
      

      we should fix this to return just the stat label, and update the various StatsComponent tests to also cover enums & make sure it works as well as strings & numbers.

      notably: i'm fairly certain this EnumStatsValues class won't work at all in a distributed (stats) request.

      1. SOLR-6682.patch
        14 kB
        Xu Zhang
      2. SOLR-6682.patch
        5 kB
        Xu Zhang

        Issue Links

          Activity

          Hide
          Hoss Man added a comment -

          found while working on SOLR-6351

          Show
          Hoss Man added a comment - found while working on SOLR-6351
          Hide
          Xu Zhang added a comment -

          Simple fix for min/max. And added tests. Single node mode.

          Will take a look distributed search tomorrow.

          Show
          Xu Zhang added a comment - Simple fix for min/max. And added tests. Single node mode. Will take a look distributed search tomorrow.
          Hide
          Xu Zhang added a comment -

          Add test for enum, both single node mode and distributed mode

          Show
          Xu Zhang added a comment - Add test for enum, both single node mode and distributed mode
          Hide
          Hoss Man added a comment -

          I've folded the latest patch in this issue into the latest patch in SOLR-6349 and plan to commit them together. (the fix & tests here are key to ensuring the new functionality there work properly with EnumField – but given other changes in Stats & tests on enum fields in that issue, i don't want to try and commit either issue independently.

          Show
          Hoss Man added a comment - I've folded the latest patch in this issue into the latest patch in SOLR-6349 and plan to commit them together. (the fix & tests here are key to ensuring the new functionality there work properly with EnumField – but given other changes in Stats & tests on enum fields in that issue, i don't want to try and commit either issue independently.
          Hide
          ASF subversion and git services added a comment -

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

          SOLR-6349 + SOLR-6682: Added support for stats.field localparams to enable/disable individual stats; Fix response when using EnumField with StatsComponent

          Show
          ASF subversion and git services added a comment - Commit 1665579 from hossman@apache.org in branch 'dev/trunk' [ https://svn.apache.org/r1665579 ] SOLR-6349 + SOLR-6682 : Added support for stats.field localparams to enable/disable individual stats; Fix response when using EnumField with StatsComponent
          Hide
          ASF subversion and git services added a comment -

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

          SOLR-6349 + SOLR-6682: test workaround since (deprecated) stats.facet doesn't garuntee order of list

          Show
          ASF subversion and git services added a comment - Commit 1665635 from hossman@apache.org in branch 'dev/trunk' [ https://svn.apache.org/r1665635 ] SOLR-6349 + SOLR-6682 : test workaround since (deprecated) stats.facet doesn't garuntee order of list
          Hide
          ASF subversion and git services added a comment -

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

          SOLR-6349 + SOLR-6682: Added support for stats.field localparams to enable/disable individual stats; Fix response when using EnumField with StatsComponent (merge r1665579, r1665635)

          Show
          ASF subversion and git services added a comment - Commit 1665639 from hossman@apache.org in branch 'dev/branches/branch_5x' [ https://svn.apache.org/r1665639 ] SOLR-6349 + SOLR-6682 : Added support for stats.field localparams to enable/disable individual stats; Fix response when using EnumField with StatsComponent (merge r1665579, r1665635)
          Hide
          Hoss Man added a comment -

          Thanks Xu

          Show
          Hoss Man added a comment - Thanks Xu
          Hide
          Timothy Potter added a comment -

          Bulk close after 5.1 release

          Show
          Timothy Potter added a comment - Bulk close after 5.1 release

            People

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

              Dates

              • Created:
                Updated:
                Resolved:

                Development