PointRangeQuery is new as of about Apache Solr 6.0 and is meant to replace the, now deprecated, NumericRangeQuery (which got renamed to LegacyNumericRangeQuery).
NOTE: The following may be confusing, and here's why. The PointRangeQueryBuilder, used by XmlQueryParser, requires that lowerTerm and upperTerm are specified, which means that neither of them may default. However, in the code, it covers its bases in case lowerTerm or upperTerm was not specified. In these cases, it defaults to the MIN_VALUE and MAX_VALUE for the respective types. Until the code is updated after 6.0.0, the defaults cannot be reached. If you are reading this after they become optional, the following may be beneficial to you. Until then, you will be required to enter a value for both.
Fields
- fieldName
(required in hierarchy here or in a parent node)
- lowerTerm
(required)
- upperTerm
(required)
- type
(optional, default "int") - long | int | double | float
- long
- If lowerTerm is not specified, default to Long.MIN_VALUE
(-9223372036854775808)
- If upperTerm is not specified, default to Long.MAX_VALUE
(9223372036854775807)
- int
- If lowerTerm is not specified, default to Integer.MIN_VALUE
(-2147483648)
- If upperTerm is not specified, default to Integer.MAX_VALUE
(2147483647)
- double
- If lowerTerm is not specified, default to
Double.NEGATIVE_INFINITY
- If upperTerm is not specified, default to
Double.POSITIVE_INFINITY
- float
- If lowerTerm is not specified, default to
Float.NEGATIVE_INFINITY
- If upperTerm is not specified, default to Float.POSITIVE_INFINITY
Example
Simply paste the following into the q= field in the Admin UI.
NOTE: This example should work, but it doesn't in my Solr 6.0.0 build because Point types aren't supported in Solr yet. I do know that the PointRangeQuery code is running when I submit this query, because it gives me error messages when I don't specify required parameters. However, somewhere in between, something isn't supported and no documents are returned. Please leave a comment if you know more.
{!xmlparser}
<PointRangeQuery
fieldName="price"
lowerTerm="0.00"
upperTerm="100.00"
type="float">
</PointRangeQuery>