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

Negative single-valued float field values are not included in facet range counts when the field has docvalues and facet.range.method=dv

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 7.0
    • Component/s: None
    • Security Level: Public (Default Security Level. Issues are Public)
    • Labels:
      None

      Description

      Found while increasing TestPointsField randomization on SOLR-10796:

      When a non-multiValued float field, either Trie- or points-based, has docvalues and a facet.range request uses facet.range.method=dv, negative values are not included in the facet range counts.

      This test added to SimpleFacetsTest succeeds for the request with facet.range.method=filter, but fails for the same request with facet.range.method=dv (failure is on line 17 in the listing below) - see the schema excerpt below for field/type:

       1:  public void testDvMethodNegativeFloatRangeFacet() throws Exception {
       2:    String field = "negative_num_f1_dv";
       3:    assertTrue(h.getCore().getLatestSchema().getField(field).hasDocValues());
       4:
       5:    final String[] commonParams = { 
       6:        "q", "*:*", "facet", "true", "facet.range.start", "-2", "facet.range.end", "0", "facet.range.gap", "2"
       7:    };
       8:    final String countAssertion
       9:        = "//lst[@name='facet_counts']/lst[@name='facet_ranges']/lst[@name='%s']/lst[@name='counts']/int[@name='-2.0'][.='1']";
      10:
      11:    assertU(adoc("id", "10001", field, "-1.0"));
      12:    assertU(commit());
      13:
      14:    assertQ(req(commonParams, "facet.range", field, "facet.range.method", "filter"),
      15:        String.format(countAssertion, field)
      16:    );
      17:    assertQ(req(commonParams, "facet.range", field, "facet.range.method", "dv"),
      18:        String.format(countAssertion, field)
      19:    );
      20:  }
      

      From schema.xml:

        <fieldType name="float" class="${solr.tests.FloatFieldType}" docValues="${solr.tests.numeric.dv}" precisionStep="0" omitNorms="true" positionIncrementGap="0"/>
        <dynamicField name="*_f1_dv" type="float" indexed="true" stored="true" docValues="true" multiValued="false"/>
      

        Attachments

        1. SOLR-11043.patch
          9 kB
          Tomás Fernández Löbbe
        2. SOLR-11043.patch
          23 kB
          Tomás Fernández Löbbe
        3. SOLR-11043.patch
          8 kB
          Tomás Fernández Löbbe

          Issue Links

            Activity

              People

              • Assignee:
                tomasflobbe Tomás Fernández Löbbe
                Reporter:
                steve_rowe Steve Rowe
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: