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

Loading...
Searching...
No Matches
NumericTokenStream.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 NUMERICTOKENSTREAM_H
8#define NUMERICTOKENSTREAM_H
9
10#include "TokenStream.h"
11
12 namespace Lucene {
13
52 class LPPAPI NumericTokenStream : public TokenStream {
53 public:
57 NumericTokenStream();
58
61 NumericTokenStream(int32_t precisionStep);
62
66 NumericTokenStream(const AttributeSourcePtr& source, int32_t precisionStep);
67
71 NumericTokenStream(const AttributeFactoryPtr& factory, int32_t precisionStep);
72
73 virtual ~NumericTokenStream();
74
75 LUCENE_CLASS(NumericTokenStream);
76
77 protected:
78 TermAttributePtr termAtt;
79 TypeAttributePtr typeAtt;
80 PositionIncrementAttributePtr posIncrAtt;
81
82 int32_t shift;
83 int32_t valSize; // valSize == 0 means not initialized
84 int32_t precisionStep;
85
86 int64_t value;
87
88 public:
90 static const String& TOKEN_TYPE_FULL_PREC();
91
93 static const String& TOKEN_TYPE_LOWER_PREC();
94
99 NumericTokenStreamPtr setLongValue(int64_t value);
100
105 NumericTokenStreamPtr setIntValue(int32_t value);
106
111 NumericTokenStreamPtr setDoubleValue(double value);
112
113 virtual void reset();
114 virtual bool incrementToken();
115 virtual String toString();
116};
117
118}
119
120#endif
LUCENE_CLASS
#define LUCENE_CLASS(Name)
Definition LuceneObject.h:24
TokenStream.h
Lucene::NumericTokenStream
This class provides a TokenStream for indexing numeric values that can be used by NumericRangeQuery o...
Definition NumericTokenStream.h:52
Lucene::NumericTokenStream::termAtt
TermAttributePtr termAtt
Definition NumericTokenStream.h:78
Lucene::NumericTokenStream::setIntValue
NumericTokenStreamPtr setIntValue(int32_t value)
Initializes the token stream with the supplied int value.
Lucene::NumericTokenStream::value
int64_t value
Definition NumericTokenStream.h:86
Lucene::NumericTokenStream::precisionStep
int32_t precisionStep
Definition NumericTokenStream.h:84
Lucene::NumericTokenStream::valSize
int32_t valSize
Definition NumericTokenStream.h:83
Lucene::NumericTokenStream::incrementToken
virtual bool incrementToken()
Consumers (ie., IndexWriter) use this method to advance the stream to the next token....
Lucene::NumericTokenStream::NumericTokenStream
NumericTokenStream()
Creates a token stream for numeric values using the default precisionStep NumericUtils#PRECISION_STEP...
Lucene::NumericTokenStream::TOKEN_TYPE_LOWER_PREC
static const String & TOKEN_TYPE_LOWER_PREC()
The lower precision tokens gets this token type assigned.
Lucene::NumericTokenStream::typeAtt
TypeAttributePtr typeAtt
Definition NumericTokenStream.h:79
Lucene::NumericTokenStream::~NumericTokenStream
virtual ~NumericTokenStream()
Lucene::NumericTokenStream::shift
int32_t shift
Definition NumericTokenStream.h:82
Lucene::NumericTokenStream::setLongValue
NumericTokenStreamPtr setLongValue(int64_t value)
Initializes the token stream with the supplied long value.
Lucene::NumericTokenStream::NumericTokenStream
NumericTokenStream(const AttributeSourcePtr &source, int32_t precisionStep)
Creates a token stream for numeric values with the specified precisionStep using the given AttributeS...
Lucene::NumericTokenStream::NumericTokenStream
NumericTokenStream(const AttributeFactoryPtr &factory, int32_t precisionStep)
Creates a token stream for numeric values with the specified precisionStep using the given AttributeF...
Lucene::NumericTokenStream::NumericTokenStream
NumericTokenStream(int32_t precisionStep)
Creates a token stream for numeric values with the specified precisionStep. The stream is not yet ini...
Lucene::NumericTokenStream::posIncrAtt
PositionIncrementAttributePtr posIncrAtt
Definition NumericTokenStream.h:80
Lucene::NumericTokenStream::toString
virtual String toString()
Returns a string representation of the object.
Lucene::NumericTokenStream::reset
virtual void reset()
Resets this stream to the beginning. This is an optional operation, so subclasses may or may not impl...
Lucene::NumericTokenStream::TOKEN_TYPE_FULL_PREC
static const String & TOKEN_TYPE_FULL_PREC()
The full precision token gets this token type assigned.
Lucene::NumericTokenStream::setDoubleValue
NumericTokenStreamPtr setDoubleValue(double value)
Initializes the token stream with the supplied double value.
Lucene::TokenStream
A TokenStream enumerates the sequence of tokens, either from Fields of a Document or from query text.
Definition TokenStream.h:44
Lucene
Definition AbstractAllTermDocs.h:12
Lucene::AttributeSourcePtr
boost::shared_ptr< AttributeSource > AttributeSourcePtr
Definition LuceneTypes.h:520
Lucene::PositionIncrementAttributePtr
boost::shared_ptr< PositionIncrementAttribute > PositionIncrementAttributePtr
Definition LuceneTypes.h:45
Lucene::TermAttributePtr
boost::shared_ptr< TermAttribute > TermAttributePtr
Definition LuceneTypes.h:58
Lucene::NumericTokenStreamPtr
boost::shared_ptr< NumericTokenStream > NumericTokenStreamPtr
Definition LuceneTypes.h:39
Lucene::AttributeFactoryPtr
boost::shared_ptr< AttributeFactory > AttributeFactoryPtr
Definition LuceneTypes.h:519
Lucene::TypeAttributePtr
boost::shared_ptr< TypeAttribute > TypeAttributePtr
Definition LuceneTypes.h:64

clucene.sourceforge.net