Xapian::NumberValueRangeProcessor Class Reference

Handle a number range. More...

#include <queryparser.h>

Inheritance diagram for Xapian::NumberValueRangeProcessor:

Inheritance graph
[legend]
Collaboration diagram for Xapian::NumberValueRangeProcessor:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 NumberValueRangeProcessor (Xapian::valueno valno_)
 NumberValueRangeProcessor (Xapian::valueno valno_, const std::string &str_, bool prefix_=true)
Xapian::valueno operator() (std::string &begin, std::string &end)
 See if <begin>.
 NumberValueRangeProcessor (Xapian::valueno valno_)
 Constructor.
 NumberValueRangeProcessor (Xapian::valueno valno_, const std::string &str_, bool prefix_=true)
 Constructor.
Xapian::valueno operator() (std::string &begin, std::string &end)
 See if <begin>.

Private Attributes

Xapian::valueno valno
bool prefix
std::string str

Detailed Description

Handle a number 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).

Definition at line 50 of file valuerangeproccompat.cc.


Constructor & Destructor Documentation

Xapian::NumberValueRangeProcessor::NumberValueRangeProcessor ( Xapian::valueno  valno_  )  [inline]

Definition at line 56 of file valuerangeproccompat.cc.

Xapian::NumberValueRangeProcessor::NumberValueRangeProcessor ( Xapian::valueno  valno_,
const std::string &  str_,
bool  prefix_ = true 
) [inline]

Definition at line 59 of file valuerangeproccompat.cc.

Xapian::NumberValueRangeProcessor::NumberValueRangeProcessor ( Xapian::valueno  valno_  )  [inline]

Constructor.

Parameters:
valno_ The value number to return from operator().

Definition at line 186 of file queryparser.h.

Xapian::NumberValueRangeProcessor::NumberValueRangeProcessor ( Xapian::valueno  valno_,
const std::string &  str_,
bool  prefix_ = true 
) [inline]

Constructor.

Parameters:
valno_ The value number to return from operator().
str_ A string to look for to recognise values as belonging to this numeric range.
prefix_ Whether to look for the string at the start or end of the values. If true, the string is a prefix; if false, the string is a suffix (default: true).
The string supplied in str_ is used by operator() to decide whether the pair of strings supplied to it constitute a valid range. If prefix_ is true, the first value in a range must begin with str_ (and the second value may optionally begin with str_); if prefix_ is false, the second value in a range must end with str_ (and the first value may optionally end with str_).

If str_ is empty, the setting of prefix_ is irrelevant, and no special strings are required at the start or end of the strings defining the range.

The remainder of both strings defining the endpoints must be valid floating point numbers. (FIXME: define format recognised).

For example, if str_ is "$" and prefix_ is true, and the range processor has been added to the queryparser, the queryparser will accept "$10..50" or "$10..$50", but not "10..50" or "10..$50" as valid ranges. If str_ is "kg" and prefix_ is false, the queryparser will accept "10..50kg" or "10kg..50kg", but not "10..50" or "10kg..50" as valid ranges.

Definition at line 221 of file queryparser.h.


Member Function Documentation

Xapian::valueno Xapian::NumberValueRangeProcessor::operator() ( std::string &  begin,
std::string &  end 
) [virtual]

See if <begin>.

.<end> is a valid value range.

If this ValueRangeProcessor recognises <begin>..<end> it returns the value number of range filter on. Otherwise it returns Xapian::BAD_VALUENO.

Implements Xapian::ValueRangeProcessor.

Xapian::valueno Xapian::NumberValueRangeProcessor::operator() ( std::string &  begin,
std::string &  end 
) [virtual]

See if <begin>.

.<end> is a valid numeric value range.

If <begin>..<end> is a valid numeric value range, and has the appropriate prefix or suffix (if specified) required for this NumberValueRangeProcessor, this method returns the value number of range filter on, and sets begin and end to the appropriate serialised values needed to delimit the range. Otherwise it returns Xapian::BAD_VALUENO.

Implements Xapian::ValueRangeProcessor.


Member Data Documentation

Xapian::valueno Xapian::NumberValueRangeProcessor::valno [private]

Definition at line 51 of file valuerangeproccompat.cc.

bool Xapian::NumberValueRangeProcessor::prefix [private]

Definition at line 52 of file valuerangeproccompat.cc.

std::string Xapian::NumberValueRangeProcessor::str [private]

Definition at line 53 of file valuerangeproccompat.cc.


The documentation for this class was generated from the following files:
Documentation for Xapian (version 1.0.10).
Generated on 24 Dec 2008 by Doxygen 1.5.2.