CLucene - a full-featured, c++ search engine
API Documentation
#include <Term.h>
Public Member Functions | |
Term (const Term *fieldTerm, const TCHAR *txt) | |
Term () | |
Constructs a blank term. | |
Term (const TCHAR *fld, const TCHAR *txt, bool internField) | |
Term (const TCHAR *fld, const TCHAR *txt) | |
Constructor. | |
~Term () | |
Destructor. | |
const TCHAR * | field () const |
Returns the field of this term, an interned string. | |
const TCHAR * | text () const |
Returns the text of this term. | |
void | set (const TCHAR *fld, const TCHAR *txt) |
Resets the field and text of a Term. | |
void | set (const Term *term, const TCHAR *txt) |
Optimized set of Term by reusing same field as this Term
| |
void | set (const TCHAR *fld, const TCHAR *txt, const bool internField) |
int32_t | compareTo (const Term *other) const |
Compares two terms, returning a negative integer if this term belongs before the argument, zero if this term is equal to the argument, and a positive integer if this term belongs after the argument. | |
bool | equals (const Term *other) const |
size_t | textLength () const |
TCHAR * | toString () const |
Forms the contents of Field and term in some kind of tuple notation field:text>. | |
size_t | hashCode () |
This is the unit of search. It is composed of two elements, the text of the word, as a string, and the name of the field that the text occured in, an interned string.
Note that terms may represent more than words from text fields, but also things like dates, email addresses, urls, etc.
IMPORTANT NOTE: Term inherits from the template class LUCENE_REFBASE which tries to do some garbage collection by counting the references an instance has. As a result of this construction you MUST use _CLDECDELETE(obj) when you want to delete an of Term!
ABOUT intrn
intrn indicates if field and text are interned or not. Interning of Strings is the process of converting duplicated strings to shared ones.
lucene::index::Term::Term | ( | const Term * | fieldTerm, | |
const TCHAR * | txt | |||
) |
lucene::index::Term::Term | ( | ) |
Constructs a blank term.
lucene::index::Term::Term | ( | const TCHAR * | fld, | |
const TCHAR * | txt, | |||
bool | internField | |||
) |
lucene::index::Term::Term | ( | const TCHAR * | fld, | |
const TCHAR * | txt | |||
) |
lucene::index::Term::~Term | ( | ) |
Destructor.
const TCHAR* lucene::index::Term::field | ( | ) | const |
Returns the field of this term, an interned string.
The field indicates the part of a document which this term came from. returns reference
const TCHAR* lucene::index::Term::text | ( | ) | const |
Returns the text of this term.
In the case of words, this is simply the text of the word. In the case of dates and other types, this is an encoding of the object as a string. returns reference
void lucene::index::Term::set | ( | const TCHAR * | fld, | |
const TCHAR * | txt | |||
) | [inline] |
Resets the field and text of a Term.
void lucene::index::Term::set | ( | const Term * | term, | |
const TCHAR * | txt | |||
) |
void lucene::index::Term::set | ( | const TCHAR * | fld, | |
const TCHAR * | txt, | |||
const bool | internField | |||
) |
int32_t lucene::index::Term::compareTo | ( | const Term * | other | ) | const |
Compares two terms, returning a negative integer if this term belongs before the argument, zero if this term is equal to the argument, and a positive integer if this term belongs after the argument.
The ordering of terms is first by field, then by text.
Referenced by lucene::index::Term_Compare::operator()().
bool lucene::index::Term::equals | ( | const Term * | other | ) | const |
Referenced by lucene::index::Term_Equals::operator()().
size_t lucene::index::Term::textLength | ( | ) | const [inline] |
TCHAR* lucene::index::Term::toString | ( | ) | const |
Forms the contents of Field and term in some kind of tuple notation field:text>.
size_t lucene::index::Term::hashCode | ( | ) |
Referenced by lucene::index::Term_Compare::operator()().