class_docstr: A range query for NUMERIC fields. Takes advantage of tiered indexing
  to speed up large ranges by matching at a high resolution at the edges of
  the range and a low resolution in the middle.
  
  >>> # Match numbers from 10 to 5925 in the "number" field.
  >>> nr = NumericRange("number", 10, 5925)
class_docstr_tok: ["A","range","query","for","NUMERIC","fields",".","Takes","advantage","of","tiered","indexing","to","speed","up","large","ranges","by","matching","at","a","high","resolution","at","the","edges","of","the","range","and","a","low","resolution","in","the","middle",".",">",">",">","#","Match","numbers","from","10","to","5925","in","the","``","number","''","field",".",">",">",">","nr","=","NumericRange","(","``","number","''",",","10",",","5925",")"]
code: def _compile_query(self, ixreader):
      from whoosh.fields import NUMERIC
      from whoosh.util.numeric import tiered_ranges
  
      field = ixreader.schema[self.fieldname]
      if not isinstance(field, NUMERIC):
          raise Exception(
              "NumericRange: field %r is not numeric" % self.fieldname
          )
  
      start = self.start
      if start is not None:
          start = field.prepare_number(start)
      end = self.end
      if end is not None:
          end = field.prepare_number(end)
  
      subqueries = []
      stb = field.sortable_to_bytes
      # Get the term ranges for the different resolutions
      ranges = tiered_ranges(
          field.numtype,
          field.bits,
          field.signed,
          start,
          end,
          field.shift_step,
          self.startexcl,
          self.endexcl,
      )
      for startnum, endnum, shift in ranges:
          if startnum == endnum:
              subq = terms.Term(self.fieldname, stb(startnum, shift))
          else:
              startbytes = stb(startnum, shift)
              endbytes = stb(endnum, shift)
              subq = TermRange(self.fieldname, startbytes, endbytes)
          subqueries.append(subq)
  
      if len(subqueries) == 1:
          q = subqueries[0]
      elif subqueries:
          q = compound.Or(subqueries, boost=self.boost)
      else:
          return qcore.NullQuery
  
      if self.constantscore:
          q = wrappers.ConstantScoreQuery(q, self.boost)
      return q
  
imports: from __future__ import division
  from whoosh.compat import b, u
  from whoosh.query import qcore, terms, compound, wrappers
  from whoosh.util.times import datetime_to_long
label_desc: Use image node_id 6 for calling the NumericRange obj's underlying member method code with example usage: obj._compile_query(ixreader) and returns: q, qcore