Xapian: API Documentation: xapian-core: Xapian::TermGenerator Class Reference

# Xapian::TermGenerator Class Reference

Parses a piece of text and generate terms. More...

List of all members.

## Public Types
enum | flags { FLAG_SPELLING = 128 }
| Flags to OR together and pass to TermGenerator::set_flags(). More...
## Public Member Functions
| TermGenerator (const TermGenerator &o)
| Copy constructor.
TermGenerator & | operator= (const TermGenerator &o)
| Assignment.
| TermGenerator ()
| Default constructor.
| ~TermGenerator ()
| Destructor.
void | set_stemmer (const Xapian::Stem &stemmer)
| Set the Xapian::Stem object to be used for generating stemmed terms.
void | set_stopper (const Xapian::Stopper *stop=NULL)
| Set the Xapian::Stopper object to be used for identifying stopwords.
void | set_document (const Xapian::Document &doc)
| Set the current document.
const Xapian::Document & | get_document () const
| Get the current document.
void | set_database (const Xapian::WritableDatabase &db)
| Set the database to index spelling data to.
flags | set_flags (flags toggle, flags mask=flags(0))
| Set flags.
void | index_text (const Xapian::Utf8Iterator &itor, Xapian::termcount wdf_inc=1, const std::string &prefix=std::string())
| Index some text.
void | index_text (const std::string &text, Xapian::termcount wdf_inc=1, const std::string &prefix=std::string())
| Index some text in a std::string.
void | index_text_without_positions (const Xapian::Utf8Iterator &itor, Xapian::termcount wdf_inc=1, const std::string &prefix=std::string())
| Index some text without positional information.
void | index_text_without_positions (const std::string &text, Xapian::termcount wdf_inc=1, const std::string &prefix=std::string())
| Index some text in a std::string without positional information.
void | increase_termpos (Xapian::termcount delta=100)
| Increase the term position used by index_text.
Xapian::termcount | get_termpos () const
| Get the current term position.
void | set_termpos (Xapian::termcount termpos)
| Set the current term position.
std::string | get_description () const
| Return a string describing this object.

## Detailed Description

Parses a piece of text and generate terms.

This module takes a piece of text and parses it to produce words which are then used to generate suitable terms for indexing. The terms generated are suitable for use with Query objects produced by the QueryParser class.

## Member Enumeration Documentation

enum Xapian::TermGenerator::flags

Flags to OR together and pass to TermGenerator::set_flags().

Enumerator:

  FLAG_SPELLING | Index data required for spelling correction.

## Member Function Documentation

void Xapian::TermGenerator::increase_termpos | ( | Xapian::termcount | delta = `100` | ) |

Increase the term position used by index_text.

This can be used between indexing text from different fields or other places to prevent phrase searches from spanning between them (e.g. between the title and body text, or between two chapters in a book).

Parameters:

  | delta | Amount to increase the term position by (default: 100).

void Xapian::TermGenerator::index_text | ( | const std::string & | text,
|  | Xapian::termcount | wdf_inc = `1`,
|  | const std::string & | prefix = `std::string()` |
| ) |  |  | `[inline]`

Index some text in a std::string.

Parameters:

  | text | The text to index.
  | wdf_inc | The wdf increment (default 1).
  | prefix | The term prefix to use (default is no prefix).

void Xapian::TermGenerator::index_text | ( | const Xapian::Utf8Iterator & | itor,
|  | Xapian::termcount | wdf_inc = `1`,
|  | const std::string & | prefix = `std::string()` |
| ) |  |  |

Index some text.

Parameters:

  | itor | Utf8Iterator pointing to the text to index.
  | wdf_inc | The wdf increment (default 1).
  | prefix | The term prefix to use (default is no prefix).

void Xapian::TermGenerator::index_text_without_positions | ( | const std::string & | text,
|  | Xapian::termcount | wdf_inc = `1`,
|  | const std::string & | prefix = `std::string()` |
| ) |  |  | `[inline]`

Index some text in a std::string without positional information.

Just like index_text, but no positional information is generated. This means that the database will be significantly smaller, but that phrase searching and NEAR won't be supported.

Parameters:

  | text | The text to index.
  | wdf_inc | The wdf increment (default 1).
  | prefix | The term prefix to use (default is no prefix).

void Xapian::TermGenerator::index_text_without_positions | ( | const Xapian::Utf8Iterator & | itor,
|  | Xapian::termcount | wdf_inc = `1`,
|  | const std::string & | prefix = `std::string()` |
| ) |  |  |

Index some text without positional information.

Just like index_text, but no positional information is generated. This means that the database will be significantly smaller, but that phrase searching and NEAR won't be supported.

Parameters:

  | itor | Utf8Iterator pointing to the text to index.
  | wdf_inc | The wdf increment (default 1).
  | prefix | The term prefix to use (default is no prefix).

flags Xapian::TermGenerator::set_flags | ( | flags | toggle,
|  | flags | mask = `flags(0)` |
| ) |  |  |

Set flags.

The new value of flags is: (flags & mask) ^ toggle

To just set the flags, pass the new flags in toggle and the default value for mask.

Parameters:

  | toggle | Flags to XOR.
  | mask | Flags to AND with first.

Returns:
  The old flags setting.

void Xapian::TermGenerator::set_stopper | ( | const Xapian::Stopper * | stop = `NULL` | ) |

Set the Xapian::Stopper object to be used for identifying stopwords.

Stemmed forms of stopwords aren't indexed, but unstemmed forms still are so that searches for phrases including stop words still work.

Parameters:

  | stop | The Stopper object to set (default NULL, which means no stopwords).

void Xapian::TermGenerator::set_termpos | ( | Xapian::termcount | termpos | ) |

Set the current term position.

Parameters:

  | termpos | The new term position to set.

The documentation for this class was generated from the following file:

- xapian/termgenerator.h