You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Andy C <an...@gmail.com> on 2016/10/19 18:47:35 UTC

Zero value fails to match Positive, Negative, or Zero interval facet

I have a field called "SCALE_double" that is defined as multivalued with
the fieldType "tdouble".

"tdouble" is defined as:

<fieldType name="tdouble" class="solr.TrieDoubleField" precisionStep="8"
omitNorms="true" positionIncrementGap="0"/>

I have a document with the value "0" indexed for this field. I am able to
successfully retrieve the document with the range query "SCALE_double:[0 TO
0]". However it doesn't match any of the interval facets I am trying to
populate that match negative, zero, or positive values:

        "{!key=\"Negative\"}(*,0)",
        "{!key=\"Positive\"}(0,*]",
        "{!key=\"Zero\"}[0,0]"

I assume this is some sort of precision issue with the TrieDoubleField
implementation (if I change the Zero interval to
"(-.0000000001,+.0000000001)" it now considers the document a match).
However the range query works fine (I had assumed that the interval was
just converted to a range query internally), and it fails to show up in the
Negative or Positive intervals either.

Any ideas what is going on, and if there is anything I can do to get this
to work correctly? I am using Solr 5.3.1. I've pasted the output from the
Solr Admin UI query below.

Thanks,
- Andy -

{
  "responseHeader": {
    "status": 0,
    "QTime": 0,
    "params": {
      "facet": "true",
      "fl": "SCALE_double",
      "facet.mincount": "1",
      "indent": "true",
      "facet.interval": "SCALE_double",
      "q": "SCALE_double:[0 TO 0]",
      "facet.limit": "100",
      "f.SCALE_double.facet.interval.set": [
        "{!key=\"Negative\"}(*,0)",
        "{!key=\"Positive\"}(0,*]",
        "{!key=\"Zero\"}[0,0]"
      ],
      "_": "1476900130184",
      "wt": "json"
    }
  },
  "response": {
    "numFound": 1,
    "start": 0,
    "docs": [
      {
        "SCALE_double": [
          0
        ]
      }
    ]
  },
  "facet_counts": {
    "facet_queries": {},
    "facet_fields": {},
    "facet_dates": {},
    "facet_ranges": {},
    "facet_intervals": {
      "SCALE_double": {
        "Negative": 0,
        "Positive": 0,
        "Zero": 0
      }
    },
    "facet_heatmaps": {}
  }
}