Lucene++ - a full-featured, c++ search engine
API Documentation
The term text of a Token. More...
#include <TermAttribute.h>
Public Member Functions | |
TermAttribute () | |
virtual | ~TermAttribute () |
virtual String | getClassName () |
boost::shared_ptr< TermAttribute > | shared_from_this () |
virtual String | toString () |
Returns a string representation of the object. | |
virtual String | term () |
Returns the Token's term text. | |
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 | setTermBuffer (const String &buffer) |
Copies the contents of buffer into the termBuffer array. | |
virtual CharArray | termBuffer () |
Returns the internal termBuffer character array which you can then directly alter. If the array is too small for your token, use resizeTermBuffer(int) to increase it. After altering the buffer be sure to call setTermLength to record the number of valid characters that were placed into the termBuffer. | |
virtual wchar_t * | termBufferArray () |
Optimized implementation of termBuffer. | |
virtual CharArray | resizeTermBuffer (int32_t newSize) |
Grows the termBuffer to at least size newSize, preserving the existing content. Note: If the next operation is to change the contents of the term buffer use setTermBuffer(char[], int, int) , setTermBuffer(String) , or setTermBuffer(String, int, int) to optimally combine the resize with the setting of the termBuffer. | |
virtual int32_t | termLength () |
Return number of valid characters (length of the term) in the termBuffer array. | |
virtual void | setTermLength (int32_t length) |
Set number of valid characters (length of the term) in the termBuffer array. Use this to truncate the termBuffer or to synchronize with external manipulation of the termBuffer. Note: to grow the size of the array, use resizeTermBuffer(int) first. | |
virtual int32_t | hashCode () |
Subclasses must implement this method and should compute a hashCode similar to this: | |
virtual void | clear () |
Clears the values in this Attribute and resets it to its default value. If this implementation implements more than one Attribute interface it clears all. | |
virtual LuceneObjectPtr | clone (const LuceneObjectPtr &other=LuceneObjectPtr()) |
Shallow clone. Subclasses must override this if they need to clone any members deeply. | |
virtual bool | equals (const LuceneObjectPtr &other) |
All values used for computation of hashCode() should be checked here for equality. | |
virtual void | copyTo (const AttributePtr &target) |
Copies the values from this Attribute into the passed-in target attribute. The target implementation must support all the Attributes this implementation supports. | |
![]() | |
virtual | ~Attribute () |
boost::shared_ptr< Attribute > | shared_from_this () |
![]() | |
virtual | ~LuceneObject () |
virtual void | initialize () |
Called directly after instantiation to create objects that depend on this object being fully constructed. | |
virtual int32_t | compareTo (const LuceneObjectPtr &other) |
Compare two objects. | |
![]() | |
virtual | ~LuceneSync () |
virtual SynchronizePtr | getSync () |
Return this object synchronize lock. | |
virtual LuceneSignalPtr | getSignal () |
Return this object signal. | |
virtual void | lock (int32_t timeout=0) |
Lock this object using an optional timeout. | |
virtual void | unlock () |
Unlock this object. | |
virtual bool | holdsLock () |
Returns true if this object is currently locked by current thread. | |
virtual void | wait (int32_t timeout=0) |
Wait for signal using an optional timeout. | |
virtual void | notifyAll () |
Notify all threads waiting for signal. | |
Static Public Member Functions | |
static String | _getClassName () |
![]() | |
static String | _getClassName () |
Protected Member Functions | |
void | growTermBuffer (int32_t newSize) |
Allocates a buffer char[] of at least newSize, without preserving the existing content. Its always used in places that set the content. | |
void | initTermBuffer () |
![]() | |
LuceneObject () | |
Protected Attributes | |
CharArray | _termBuffer |
int32_t | _termLength |
![]() | |
SynchronizePtr | objectLock |
LuceneSignalPtr | objectSignal |
Static Protected Attributes | |
static const int32_t | MIN_BUFFER_SIZE |
The term text of a Token.
Lucene::TermAttribute::TermAttribute | ( | ) |
|
virtual |
|
inlinestatic |
|
virtual |
Clears the values in this Attribute and resets it to its default value. If this implementation implements more than one Attribute interface it clears all.
Implements Lucene::Attribute.
|
virtual |
Shallow clone. Subclasses must override this if they need to clone any members deeply.
base | clone reference - null when called initially, then set in top virtual override. |
Implements Lucene::Attribute.
|
virtual |
Copies the values from this Attribute into the passed-in target attribute. The target implementation must support all the Attributes this implementation supports.
Implements Lucene::Attribute.
|
virtual |
All values used for computation of hashCode()
should be checked here for equality.
see also LuceneObject#equals(Object)
Implements Lucene::Attribute.
|
inlinevirtual |
Reimplemented from Lucene::Attribute.
|
protected |
Allocates a buffer char[] of at least newSize, without preserving the existing content. Its always used in places that set the content.
newSize | minimum size of the buffer |
|
virtual |
Subclasses must implement this method and should compute a hashCode similar to this:
int32_t hashCode() { int32_t code = startOffset; code = code * 31 + endOffset; return code; }
see also equals(Object)
Implements Lucene::Attribute.
|
protected |
|
virtual |
Grows the termBuffer to at least size newSize, preserving the existing content. Note: If the next operation is to change the contents of the term buffer use setTermBuffer(char[], int, int)
, setTermBuffer(String)
, or setTermBuffer(String, int, int)
to optimally combine the resize with the setting of the termBuffer.
newSize | minimum size of the new termBuffer |
|
virtual |
Copies the contents of buffer into the termBuffer array.
buffer | the buffer to copy |
|
virtual |
Copies the contents of buffer, starting at offset for length characters, into the termBuffer array.
buffer | the buffer to copy |
offset | the index in the buffer of the first character to copy |
length | the number of characters to copy |
|
virtual |
Set number of valid characters (length of the term) in the termBuffer array. Use this to truncate the termBuffer or to synchronize with external manipulation of the termBuffer. Note: to grow the size of the array, use resizeTermBuffer(int)
first.
length | the truncated length |
|
inline |
|
virtual |
Returns the Token's term text.
This method has a performance penalty because the text is stored internally in a char[]. If possible, use termBuffer()
and termLength()
directly instead. If you really need a String, use this method, which is nothing more than a convenience call to new String(token.termBuffer(), 0, token.termLength())
|
virtual |
Returns the internal termBuffer character array which you can then directly alter. If the array is too small for your token, use resizeTermBuffer(int)
to increase it. After altering the buffer be sure to call setTermLength
to record the number of valid characters that were placed into the termBuffer.
|
virtual |
Optimized implementation of termBuffer.
|
virtual |
Return number of valid characters (length of the term) in the termBuffer array.
|
virtual |
Returns a string representation of the object.
Reimplemented from Lucene::LuceneObject.
|
protected |
|
protected |
|
staticprotected |