Lucene++ - a full-featured, c++ search engine
API Documentation

Loading...
Searching...
No Matches
NumericRangeQuery.h
Go to the documentation of this file.
1
2// Copyright (c) 2009-2014 Alan Wright. All rights reserved.
3// Distributable under the terms of either the Apache License (Version 2.0)
4// or the GNU Lesser General Public License.
6
7#ifndef NUMERICRANGEQUERY_H
8#define NUMERICRANGEQUERY_H
9
10#include "MultiTermQuery.h"
11#include "FilteredTermEnum.h"
12#include "NumericUtils.h"
13
14 namespace Lucene {
15
108 class LPPAPI NumericRangeQuery : public MultiTermQuery {
109 public:
110 NumericRangeQuery(const String& field, int32_t precisionStep, int32_t valSize, NumericValue min, NumericValue max, bool minInclusive, bool maxInclusive);
111 virtual ~NumericRangeQuery();
112
113 LUCENE_CLASS(NumericRangeQuery);
114
115INTERNAL:
116 String field;
117 int32_t precisionStep;
118 int32_t valSize;
119 NumericValue min;
120 NumericValue max;
121 bool minInclusive;
122 bool maxInclusive;
123
124 public:
125 using MultiTermQuery::toString;
126
128 static NumericRangeQueryPtr newLongRange(const String& field, int32_t precisionStep, int64_t min, int64_t max, bool minInclusive, bool maxInclusive);
129
132 static NumericRangeQueryPtr newLongRange(const String& field, int64_t min, int64_t max, bool minInclusive, bool maxInclusive);
133
135 static NumericRangeQueryPtr newIntRange(const String& field, int32_t precisionStep, int32_t min, int32_t max, bool minInclusive, bool maxInclusive);
136
139 static NumericRangeQueryPtr newIntRange(const String& field, int32_t min, int32_t max, bool minInclusive, bool maxInclusive);
140
142 static NumericRangeQueryPtr newDoubleRange(const String& field, int32_t precisionStep, double min, double max, bool minInclusive, bool maxInclusive);
143
146 static NumericRangeQueryPtr newDoubleRange(const String& field, double min, double max, bool minInclusive, bool maxInclusive);
147
152 static NumericRangeQueryPtr newNumericRange(const String& field, int32_t precisionStep, NumericValue min, NumericValue max, bool minInclusive, bool maxInclusive);
153
159 static NumericRangeQueryPtr newNumericRange(const String& field, NumericValue min, NumericValue max, bool minInclusive, bool maxInclusive);
160
162 String getField();
163
165 bool includesMin();
166
168 bool includesMax();
169
171 NumericValue getMin();
172
174 NumericValue getMax();
175
176 virtual LuceneObjectPtr clone(const LuceneObjectPtr& other = LuceneObjectPtr());
177 virtual String toString(const String& field);
178 virtual bool equals(const LuceneObjectPtr& other);
179 virtual int32_t hashCode();
180
181 protected:
182 virtual FilteredTermEnumPtr getEnum(const IndexReaderPtr& reader);
183
184 friend class NumericRangeTermEnum;
185};
186
187}
188
189#endif
FilteredTermEnum.h
LUCENE_CLASS
#define LUCENE_CLASS(Name)
Definition LuceneObject.h:24
MultiTermQuery.h
NumericUtils.h
Lucene::MultiTermQuery
An abstract Query that matches documents containing a subset of terms provided by a FilteredTermEnum ...
Definition MultiTermQuery.h:31
Lucene::NumericRangeQuery
A Query that matches numeric values within a specified range. To use this, you must first index the n...
Definition NumericRangeQuery.h:108
Lucene::NumericRangeQuery::newIntRange
static NumericRangeQueryPtr newIntRange(const String &field, int32_t precisionStep, int32_t min, int32_t max, bool minInclusive, bool maxInclusive)
Factory that creates a NumericRangeFilter, that filters a int range using the given precisionStep.
Lucene::NumericRangeQuery::newLongRange
static NumericRangeQueryPtr newLongRange(const String &field, int64_t min, int64_t max, bool minInclusive, bool maxInclusive)
Factory that creates a NumericRangeFilter, that filters a long range using the default precisionStep ...
Lucene::NumericRangeQuery::newNumericRange
static NumericRangeQueryPtr newNumericRange(const String &field, NumericValue min, NumericValue max, bool minInclusive, bool maxInclusive)
Factory that creates a NumericRangeQuery, that queries a int, long or double range using the default ...
Lucene::NumericRangeQuery::equals
virtual bool equals(const LuceneObjectPtr &other)
Return whether two objects are equal.
Lucene::NumericRangeQuery::getMax
NumericValue getMax()
Returns the upper value of this range query.
Lucene::NumericRangeQuery::valSize
int32_t valSize
Definition NumericRangeQuery.h:118
Lucene::NumericRangeQuery::NumericRangeQuery
NumericRangeQuery(const String &field, int32_t precisionStep, int32_t valSize, NumericValue min, NumericValue max, bool minInclusive, bool maxInclusive)
Lucene::NumericRangeQuery::hashCode
virtual int32_t hashCode()
Return hash code for this object.
Lucene::NumericRangeQuery::newNumericRange
static NumericRangeQueryPtr newNumericRange(const String &field, int32_t precisionStep, NumericValue min, NumericValue max, bool minInclusive, bool maxInclusive)
Factory that creates a NumericRangeQuery, that queries a int, long or double range using the given pr...
Lucene::NumericRangeQuery::getEnum
virtual FilteredTermEnumPtr getEnum(const IndexReaderPtr &reader)
Construct the enumeration to be used, expanding the pattern term.
Lucene::NumericRangeQuery::includesMin
bool includesMin()
Returns true if the lower endpoint is inclusive.
Lucene::NumericRangeQuery::getMin
NumericValue getMin()
Returns the lower value of this range query.
Lucene::NumericRangeQuery::minInclusive
bool minInclusive
Definition NumericRangeQuery.h:121
Lucene::NumericRangeQuery::~NumericRangeQuery
virtual ~NumericRangeQuery()
Lucene::NumericRangeQuery::newDoubleRange
static NumericRangeQueryPtr newDoubleRange(const String &field, double min, double max, bool minInclusive, bool maxInclusive)
Factory that creates a NumericRangeFilter, that filters a double range using the default precisionSte...
Lucene::NumericRangeQuery::getField
String getField()
Returns the field name for this query.
Lucene::NumericRangeQuery::toString
virtual String toString(const String &field)
Prints a query to a string, with field assumed to be the default field and omitted.
Lucene::NumericRangeQuery::newLongRange
static NumericRangeQueryPtr newLongRange(const String &field, int32_t precisionStep, int64_t min, int64_t max, bool minInclusive, bool maxInclusive)
Factory that creates a NumericRangeFilter, that filters a long range using the given precisionStep.
Lucene::NumericRangeQuery::clone
virtual LuceneObjectPtr clone(const LuceneObjectPtr &other=LuceneObjectPtr())
Returns a clone of this query.
Lucene::NumericRangeQuery::min
NumericValue min
Definition NumericRangeQuery.h:119
Lucene::NumericRangeQuery::newDoubleRange
static NumericRangeQueryPtr newDoubleRange(const String &field, int32_t precisionStep, double min, double max, bool minInclusive, bool maxInclusive)
Factory that creates a NumericRangeFilter, that filters a double range using the given precisionStep.
Lucene::NumericRangeQuery::precisionStep
int32_t precisionStep
Definition NumericRangeQuery.h:117
Lucene::NumericRangeQuery::includesMax
bool includesMax()
Returns true if the upper endpoint is inclusive.
Lucene::NumericRangeQuery::max
NumericValue max
Definition NumericRangeQuery.h:120
Lucene::NumericRangeQuery::maxInclusive
bool maxInclusive
Definition NumericRangeQuery.h:122
Lucene::NumericRangeQuery::newIntRange
static NumericRangeQueryPtr newIntRange(const String &field, int32_t min, int32_t max, bool minInclusive, bool maxInclusive)
Factory that creates a NumericRangeFilter, that filters a int range using the default precisionStep N...
Lucene
Definition AbstractAllTermDocs.h:12
Lucene::LuceneObjectPtr
boost::shared_ptr< LuceneObject > LuceneObjectPtr
Definition LuceneTypes.h:539
Lucene::NumericRangeQueryPtr
boost::shared_ptr< NumericRangeQuery > NumericRangeQueryPtr
Definition LuceneTypes.h:394
Lucene::IndexReaderPtr
boost::shared_ptr< IndexReader > IndexReaderPtr
Definition LuceneTypes.h:157
Lucene::FilteredTermEnumPtr
boost::shared_ptr< FilteredTermEnum > FilteredTermEnumPtr
Definition LuceneTypes.h:365

clucene.sourceforge.net