Lucene++ - a full-featured, c++ search engine
API Documentation
Go to the documentation of this file.
84 Token(int32_t start, int32_t end);
90 Token(int32_t start, int32_t end,
const String& type);
96 Token(int32_t start, int32_t end, int32_t flags);
103 Token(
const String& text, int32_t start, int32_t end);
111 Token(
const String& text, int32_t start, int32_t end,
const String& type);
119 Token(
const String& text, int32_t start, int32_t end, int32_t flags);
122 Token(CharArray startTermBuffer, int32_t termBufferOffset, int32_t termBufferLength, int32_t start, int32_t end);
180 virtual void setTermBuffer(
const wchar_t* buffer, int32_t offset, int32_t length);
190 virtual void setTermBuffer(
const String& buffer, int32_t offset, int32_t length);
238 virtual void setOffset(int32_t startOffset, int32_t endOffset);
272 TokenPtr clone(CharArray newTermBuffer, int32_t newTermOffset, int32_t newTermLength, int32_t newStartOffset, int32_t newEndOffset);
280 TokenPtr reinit(CharArray newTermBuffer, int32_t newTermOffset, int32_t newTermLength, int32_t newStartOffset, int32_t newEndOffset,
const String& newType);
285 TokenPtr reinit(CharArray newTermBuffer, int32_t newTermOffset, int32_t newTermLength, int32_t newStartOffset, int32_t newEndOffset);
290 TokenPtr reinit(
const String& newTerm, int32_t newStartOffset, int32_t newEndOffset,
const String& newType);
295 TokenPtr reinit(
const String& newTerm, int32_t newTermOffset, int32_t newTermLength, int32_t newStartOffset, int32_t newEndOffset,
const String& newType);
300 TokenPtr reinit(
const String& newTerm, int32_t newStartOffset, int32_t newEndOffset);
305 TokenPtr reinit(
const String& newTerm, int32_t newTermOffset, int32_t newTermLength, int32_t newStartOffset, int32_t newEndOffset);
314 void reinit(
const TokenPtr& prototype, CharArray newTermBuffer, int32_t offset, int32_t length);
323 void ConstructToken(int32_t start, int32_t end,
const String& type, int32_t flags);
virtual void setPayload(const PayloadPtr &payload)
Sets this Token's payload.
virtual bool equals(const LuceneObjectPtr &other)
Return whether two objects are equal.
virtual void setType(const String &type)
Set the lexical type.
TokenPtr reinit(CharArray newTermBuffer, int32_t newTermOffset, int32_t newTermLength, int32_t newStartOffset, int32_t newEndOffset)
Shorthand for calling clear, setTermBuffer(char[], int, int), setStartOffset, setEndOffset,...
Token(const String &text, int32_t start, int32_t end, const String &type)
Constructs a Token with the given term text, start and end offsets and type. NOTE: for better indexin...
TokenPtr clone(CharArray newTermBuffer, int32_t newTermOffset, int32_t newTermLength, int32_t newStartOffset, int32_t newEndOffset)
Makes a clone, but replaces the term buffer and start/end offset in the process. This is more efficie...
Token(int32_t start, int32_t end, int32_t flags)
Constructs a Token with null text and start and end offsets plus flags.
virtual void setTermBuffer(const wchar_t *buffer, int32_t offset, int32_t length)
Copies the contents of buffer, starting at offset for length characters, into the termBuffer array.
virtual void setOffset(int32_t startOffset, int32_t endOffset)
Set the starting and ending offset.
#define LUCENE_CLASS(Name)
Definition: LuceneObject.h:24
virtual bool equals(const LuceneObjectPtr &other)
All values used for computation of hashCode() should be checked here for equality.
virtual void setFlags(int32_t flags)
virtual int32_t hashCode()
Return hash code for this object.
boost::shared_ptr< LuceneObject > LuceneObjectPtr
Definition: LuceneTypes.h:539
Token(const String &text, int32_t start, int32_t end, int32_t flags)
Constructs a Token with the given term text, start and end offsets and flags. NOTE: for better indexi...
TokenPtr reinit(const String &newTerm, int32_t newTermOffset, int32_t newTermLength, int32_t newStartOffset, int32_t newEndOffset)
Shorthand for calling clear, setTermBuffer(String, int, int), setStartOffset, setEndOffset,...
Base class for Attributes that can be added to a AttributeSource.
Definition: Attribute.h:18
void reinit(const TokenPtr &prototype)
Copy the prototype token's fields into this one. Note: Payloads are shared.
Creates a TokenAttributeFactory returning Token as instance for the basic attributes and for all othe...
Definition: Token.h:338
void growTermBuffer(int32_t newSize)
Allocates a buffer char[] of at least newSize, without preserving the existing content....
virtual String type()
Returns this Token's lexical type. Defaults to "word".
virtual PayloadPtr getPayload()
Returns this Token's payload.
Definition: AttributeSource.h:14
TokenPtr reinit(CharArray newTermBuffer, int32_t newTermOffset, int32_t newTermLength, int32_t newStartOffset, int32_t newEndOffset, const String &newType)
Shorthand for calling clear, setTermBuffer(char[], int, int), setStartOffset, setEndOffset,...
virtual void setPositionIncrement(int32_t positionIncrement)
Set the position increment. This determines the position of this token relative to the previous Token...
void reinit(const TokenPtr &prototype, CharArray newTermBuffer, int32_t offset, int32_t length)
Copy the prototype token's fields into this one, with a different term. Note: Payloads are shared.
boost::shared_ptr< Token > TokenPtr
Definition: LuceneTypes.h:59
Token(const String &text, int32_t start, int32_t end)
Constructs a Token with the given term text, start and end offsets. The type defaults to "word....
String _type
Definition: Token.h:138
virtual CharArray termBuffer()
Returns the internal termBuffer character array which you can then directly alter....
Definition: AbstractAllTermDocs.h:12
TokenAttributeFactory(const AttributeFactoryPtr &delegate)
virtual void setEndOffset(int32_t offset)
Set the ending offset.
int32_t _termLength
Definition: Token.h:135
virtual String term()
Returns the Token's term text.
virtual int32_t getPositionIncrement()
Returns the position increment of this Token.
virtual int32_t hashCode()
Subclasses must implement this method and should compute a hashCode similar to this:
virtual CharArray resizeTermBuffer(int32_t newSize)
Grows the termBuffer to at least size newSize, preserving the existing content. Note: If the next ope...
static const int32_t MIN_BUFFER_SIZE
Definition: Token.h:132
TokenPtr reinit(const String &newTerm, int32_t newTermOffset, int32_t newTermLength, int32_t newStartOffset, int32_t newEndOffset, const String &newType)
Shorthand for calling clear, setTermBuffer(String), setStartOffset, setEndOffset, setType.
static const String & DEFAULT_TYPE()
Token(int32_t start, int32_t end)
Constructs a Token with null text and start and end offsets.
virtual ~TokenAttributeFactory()
virtual void setTermBuffer(const String &buffer)
Copies the contents of buffer into the termBuffer array.
Token()
Constructs a Token will null text.
boost::shared_ptr< Attribute > AttributePtr
Definition: LuceneTypes.h:518
static AttributeFactoryPtr TOKEN_ATTRIBUTE_FACTORY()
Convenience factory that returns Token as implementation for the basic attributes.
int32_t flags
Definition: Token.h:139
virtual LuceneObjectPtr clone(const LuceneObjectPtr &other=LuceneObjectPtr())
Shallow clone. Subclasses must override this if they need to clone any members deeply.
int32_t positionIncrement
Definition: Token.h:141
boost::shared_ptr< Payload > PayloadPtr
Definition: LuceneTypes.h:198
void reinit(const TokenPtr &prototype, const String &newTerm)
Copy the prototype token's fields into this one, with a different term. Note: Payloads are shared.
int32_t _startOffset
Definition: Token.h:136
virtual void setStartOffset(int32_t offset)
Set the starting offset.
virtual String toString()
Returns a string representation of the object.
CharArray _termBuffer
Definition: Token.h:134
void clearNoTermBuffer()
Like clear() but doesn't clear termBuffer/text.
PayloadPtr payload
Definition: Token.h:140
virtual AttributePtr createAttributeInstance(const String &className)
returns an Attribute.
virtual int32_t startOffset()
Returns this Token's starting offset, the position of the first character corresponding to this token...
virtual int32_t endOffset()
Returns this Token's ending offset, one greater than the position of the last character corresponding...
AttributeFactoryPtr delegate
Definition: Token.h:343
Token(CharArray startTermBuffer, int32_t termBufferOffset, int32_t termBufferLength, int32_t start, int32_t end)
Constructs a Token with the given term buffer (offset and length), start and end offsets.
virtual int32_t getFlags()
Get the bitset for any bits that have been set. This is completely distinct from type(),...
Token(int32_t start, int32_t end, const String &type)
Constructs a Token with null text and start and end offsets plus the Token type.
virtual void setTermLength(int32_t length)
Set number of valid characters (length of the term) in the termBuffer array. Use this to truncate the...
virtual void copyTo(const AttributePtr &target)
Copies the values from this Attribute into the passed-in target attribute. The target implementation ...
TokenPtr reinit(const String &newTerm, int32_t newStartOffset, int32_t newEndOffset)
Shorthand for calling clear, setTermBuffer(String), setStartOffset, setEndOffset, setType on Token::D...
virtual void setTermBuffer(const String &buffer, int32_t offset, int32_t length)
Copies the contents of buffer, starting at offset and continuing for length characters,...
virtual void clear()
Resets the term text, payload, flags, and positionIncrement, startOffset, endOffset and token type to...
void ConstructToken(int32_t start, int32_t end, const String &type, int32_t flags)
Construct Token and initialize values.
boost::shared_ptr< AttributeFactory > AttributeFactoryPtr
Definition: LuceneTypes.h:519
virtual wchar_t * termBufferArray()
Optimized implementation of termBuffer.
A Token is an occurrence of a term from the text of a field. It consists of a term's text,...
Definition: Token.h:76
int32_t _endOffset
Definition: Token.h:137
TokenPtr reinit(const String &newTerm, int32_t newStartOffset, int32_t newEndOffset, const String &newType)
Shorthand for calling clear, setTermBuffer(String), setStartOffset, setEndOffset, setType.
virtual int32_t termLength()
Return number of valid characters (length of the term) in the termBuffer array.
clucene.sourceforge.net