- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | List of all members
Xapian::Snipper Class Reference

Class used to generate snippets from a given text. More...

## Public Member Functions
| Snipper ()
| Default constructor.
| Snipper (const Snipper &other)
| Copy constructor.
Snipper & | operator= (const Snipper &other)
| Assignment.
| ~Snipper ()
| Destructor.
void | set_stemmer (const Xapian::Stem &stemmer)
| Set the stemmer for the Snipper object. More...
void | set_mset (const MSet &mset, Xapian::doccount rm_docno=10)
| Set the MSet and calculate the relevance model according to it. More...
std::string | generate_snippet (const std::string &text, size_t length=200, Xapian::termcount window_size=25, double smoothing=0.5)
| Generate snippet from given text. More...
std::string | get_description () const
| Return a string describing this object.

## Detailed Description

Class used to generate snippets from a given text.

For generating a snippet, a MSet is needed to calculate a relevance model.

## Member Function Documentation

std::string Xapian::Snipper::generate_snippet | ( | const std::string & | text,
|  | size_t | length = `200`,
|  | Xapian::termcount | window_size = `25`,
|  | double | smoothing = `0.5`
| ) |  |

Generate snippet from given text.

Parameters

  text | The text from which to generate the snippet
  length | Maximum length of the result in bytes (default: 200)
  window_size | Size of the window (default: 25)
  smoothing | Smoothing coefficient (default: 0.5)

Returns
  Text of the snippet relevant to the model from input.

void Xapian::Snipper::set_mset | ( | const MSet & | mset,
|  | Xapian::doccount | rm_docno = `10`
| ) |  |

Set the MSet and calculate the relevance model according to it.

Parameters

  mset | MSet with the documents relevant to the query.
  rm_docno | Maximum number of documents for the relevance model (default: 10).

void Xapian::Snipper::set_stemmer | ( | const Xapian::Stem & | stemmer | ) |

Set the stemmer for the Snipper object.

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

- xapian/snipper.h