xapian-core  2.0.0
Public Member Functions | List of all members
Xapian::UnitRangeProcessor Class Reference

Handle a byte unit range. More...

#include <queryparser.h>

+ Inheritance diagram for Xapian::UnitRangeProcessor:
+ Collaboration diagram for Xapian::UnitRangeProcessor:

Public Member Functions

 UnitRangeProcessor (Xapian::valueno slot_, std::string_view str_={})
 Constructor. More...
 
Xapian::Query operator() (const std::string &begin, const std::string &end)
 Check for a valid byte value range. More...
 
- Public Member Functions inherited from Xapian::RangeProcessor
 RangeProcessor ()
 Default constructor. More...
 
 RangeProcessor (Xapian::valueno slot_, std::string_view str_={}, unsigned flags_=0)
 Constructor. More...
 
virtual ~RangeProcessor ()
 Destructor. More...
 
Xapian::Query check_range (const std::string &b, const std::string &e)
 Check prefix/suffix on range. More...
 
RangeProcessorrelease ()
 Start reference counting this object. More...
 
const RangeProcessorrelease () const
 Start reference counting this object. More...
 
- Public Member Functions inherited from Xapian::Internal::opt_intrusive_base
 opt_intrusive_base (const opt_intrusive_base &)
 
opt_intrusive_baseoperator= (const opt_intrusive_base &)
 
 opt_intrusive_base ()
 Construct object which is initially not reference counted. More...
 
virtual ~opt_intrusive_base ()
 
void ref () const
 
void unref () const
 

Additional Inherited Members

- Public Attributes inherited from Xapian::Internal::opt_intrusive_base
unsigned _refs
 Reference count. More...
 
- Protected Member Functions inherited from Xapian::Internal::opt_intrusive_base
void release () const
 Start reference counting. More...
 
- Protected Attributes inherited from Xapian::RangeProcessor
Xapian::valueno slot
 The value slot to process. More...
 
std::string str
 The prefix (or suffix with RP_SUFFIX) string to look for. More...
 
unsigned flags
 Flags. More...
 

Detailed Description

Handle a byte unit range.

This class must be used on values which have been encoded using Xapian::sortable_serialise() which turns numbers into strings which will sort in the same order as the numbers (the same values can be used to implement a numeric sort).

Since
Added in Xapian 2.0.0.

Definition at line 430 of file queryparser.h.

Constructor & Destructor Documentation

◆ UnitRangeProcessor()

Xapian::UnitRangeProcessor::UnitRangeProcessor ( Xapian::valueno  slot_,
std::string_view  str_ = {} 
)
inline

Constructor.

Parameters
slot_The value slot number to query.
str_A string to look for to recognise values as belonging to this numeric range.

The string supplied in str_ is the prefix plus ":" that defines the field upon which the range query is performed.

For example, if str_ is "size:", and the range processor has been added to the queryparser, the queryparser will accept "size:3K..10K" as a valid range.

Definition at line 446 of file queryparser.h.

Member Function Documentation

◆ operator()()

Xapian::Query Xapian::UnitRangeProcessor::operator() ( const std::string &  begin,
const std::string &  end 
)
virtual

Check for a valid byte value range.

If BEGIN..END is a valid numeric byte range with the specified prefix the prefix is removed, the string converted to a number, unit normalized and encoded with Xapian::sortable_serialise(), and a value range query is built.

Parameters
beginThe start of the range as specified in the query string by the user.
endThe end of the range as specified in the query string by the user.

Reimplemented from Xapian::RangeProcessor.

Definition at line 344 of file valuerangeproc.cc.

References Xapian::check_byte_unit(), Xapian::Query::OP_INVALID, and Xapian::sortable_serialise().


The documentation for this class was generated from the following files: