Tuesday, May 24, 2016

Apache Solr - LegacyNumericRangeQuery

NumericRangeQuery was renamed to LegacyNumericRangeQuery about lucene 6.0.0 and marked deprecated. If you're on an older system, you will find it using NumericRangeQuery. Afterwards, LegacyNumericRangeQuery will be what you will want to use.

It looks like NumericRangeQuery has been replaced with PointRangeQuery.

Fields

  • fieldName (required here or in a parent node)
  • lowerTerm (optional, default null)
  • upperTerm (optional, default null)
  • includeLower (optional, default true)
  • includeUpper (optional, default true)
  • precisionStep (optional, default 16)
  • type (optional, default "int") - long | int | double | float

Examples

Simply paste the following into the q= field in the Admin UI.
NOTE: These examples will not work in Solr since Solr does not support Point types.

Lucene 6.0.0+:
{!xmlparser}
<LegacyNumericRangeQuery
 fieldName="price"
 lowerTerm="0"
 upperTerm="10"
 includeLower="true"
 includeUpper="true"
 precisionStep="16"
 type="float">
</LegacyNumericRangeQuery>

Before Lucene 6.0.0:
{!xmlparser}
<NumericRangeQuery
 fieldName="price"
 lowerTerm="0"
 upperTerm="10"
 includeLower="true"
 includeUpper="true"
 precisionStep="16"
 type="float">
</NumericRangeQuery>

1 comment:

  1. I really appreciate the information shared above. It’s of great help. MaxMunus provides Remote Support For Corporate and for Individuals. If anyone is facing any issue in his project of #APACHE SOLR we can support them remotely , kindly contact us http://www.maxmunus.com/contact
    MaxMunus Offer World Class Industry best Consultant on# APACHE SOLR. We provide end to end Remote Support on Projects. MaxMunus is successfully doing remote support for countries like India, USA, UK, Australia, Switzerland, Qatar, Saudi Arabia, Bangladesh, Bahrain, and UAE etc.
    Saurabh
    MaxMunus
    E-mail: saurabh@maxmunus.com
    Skype id: saurabhmaxmunus
    Ph:(0) 8553576305/ 080 - 41103383
    http://www.maxmunus.com

    ReplyDelete