XapianDocument

XapianDocument — A document inside a database

Functions

Object Hierarchy

    GObject
    ╰── XapianDocument

Description

XapianDocument is a class representing a document inside a Xapian database.

Functions

xapian_document_new ()

XapianDocument *
xapian_document_new (void);

Creates a new, empty document.

Returns

the newly created XapianDocument.

[transfer full]


xapian_document_get_value ()

char *
xapian_document_get_value (XapianDocument *document,
                           unsigned int slot);

Retrieves the value associated to the slot number inside document .

Parameters

document

a XapianDocument

 

slot

a slot number

 

Returns

the value, or NULL.

[transfer full]


xapian_document_get_numeric_value ()

double
xapian_document_get_numeric_value (XapianDocument *document,
                                   unsigned int slot);

Retrieves the numeric value associated to the slot number inside document .

Parameters

document

a XapianDocument

 

slot

a slot number

 

Returns

the numeric value

Since: 1.4


xapian_document_add_value ()

void
xapian_document_add_value (XapianDocument *document,
                           unsigned int slot,
                           const char *value);

Sets (or replaces) value at the given slot number inside the document .

Parameters

document

a XapianDocument

 

slot

a slot number

 

value

the value to associate to the slot number

 

xapian_document_add_numeric_value ()

void
xapian_document_add_numeric_value (XapianDocument *document,
                                   unsigned int slot,
                                   double value);

Sets (or replaces) a value at the given slot number inside the document .

The given value will be serialised internally using xapian_sortable_serialise().

Parameters

document

a XapianDocument

 

slot

a slot number

 

value

the value to associate to the slot number

 

Since: 1.4


xapian_document_remove_value ()

void
xapian_document_remove_value (XapianDocument *document,
                              unsigned int slot);

Removes any value associated with the slot number.

Parameters

document

a XapianDocument

 

slot

a slot number

 

xapian_document_clear_values ()

void
xapian_document_clear_values (XapianDocument *document);

Removes all values from document .

Parameters

document

a XapianDocument

 

xapian_document_get_values_count ()

unsigned int
xapian_document_get_values_count (XapianDocument *document);

Retrieves the number of values in the document .

Parameters

document

a XapianDocument

 

Returns

the number of values


xapian_document_get_data ()

char *
xapian_document_get_data (XapianDocument *document);

Retrieves the content of document .

This is a potentially expensive operation, so it should not be used when matching a document; typically, you should use the values API (xapian_document_add_value() and xapian_document_get_value()) for fast access to matching terms or data.

Parameters

document

a XapianDocument

 

Returns

a string containing the contents of the document.

[transfer full]


xapian_document_set_data ()

void
xapian_document_set_data (XapianDocument *document,
                          const char *data);

Sets the contents of the document .

Parameters

document

a XapianDocument

 

data

the content of the document

 

xapian_document_get_doc_id ()

unsigned int
xapian_document_get_doc_id (XapianDocument *document);

Retrieves the document id of document .

Parameters

document

a XapianDocument

 

Returns

the document id


xapian_document_get_description ()

char *
xapian_document_get_description (XapianDocument *document);

Retrieves a description of document , typically used when debugging.

Parameters

document

a XapianDocument

 

Returns

a description of the document.

[transfer full]


xapian_document_add_posting ()

void
xapian_document_add_posting (XapianDocument *document,
                             const char *tname,
                             unsigned int term_pos,
                             unsigned int wdf_increment);

Adds a term to the document, with positional information.

See also: xapian_document_add_term(), xapian_document_add_term_full()

Parameters

document

a XapianDocument

 

tname

the term to add

 

term_pos

the position of tname

 

wdf_increment

the increment to be applied to the WDF

 

xapian_document_remove_posting ()

void
xapian_document_remove_posting (XapianDocument *document,
                                const char *tname,
                                unsigned int term_pos,
                                unsigned int wdf_decrement);

Removes a posting of a term inside document .

Note that the term will still index the document, even if all the occurrences have been removed. To completely remove tname from the document , use xapian_document_remove_term() instead.

Parameters

document

a XapianDocument

 

tname

the term to remove

 

term_pos

the position of the term

 

wdf_decrement

the decrement to be applied to the WDF when removing the term

 

xapian_document_add_term ()

void
xapian_document_add_term (XapianDocument *document,
                          const char *tname);

Adds a term to the document, without positional information, and with a default WDF increment of 1.

Parameters

document

a XapianDocument

 

tname

the term to add

 

xapian_document_add_term_full ()

void
xapian_document_add_term_full (XapianDocument *document,
                               const char *tname,
                               unsigned int wdf_increment);

Adds a term to the document, without positional information.

Parameters

document

a XapianDocument

 

tname

the term to add

 

wdf_increment

the increment to be applied to the WDF

 

xapian_document_add_boolean_term ()

void
xapian_document_add_boolean_term (XapianDocument *document,
                                  const char *tname);

Adds a term to the document without incrementing the WDF.

This function is the equivalent of xapian_document_add_term_full() with a WDF increment set to 0.

Parameters

document

a XapianDocument

 

tname

the term to add

 

xapian_document_remove_term ()

void
xapian_document_remove_term (XapianDocument *document,
                             const char *tname);

Removes tname from the list of terms stored inside document .

Parameters

document

a XapianDocument

 

tname

the term to remove

 

xapian_document_clear_terms ()

void
xapian_document_clear_terms (XapianDocument *document);

Clears all the terms stored in the document .

Parameters

document

a XapianDocument

 

xapian_document_get_termlist_count ()

unsigned int
xapian_document_get_termlist_count (XapianDocument *document);

Retrieves the number of terms registered in the document .

Parameters

document

a XapianDocument

 

Returns

the number of terms

Types and Values