Uploaded image for project: '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
    • Status: Closed
    • Priority: 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.

        Attachments

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

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: