Utilities

Utilities — Utility API

Functions

Types and Values

Object Hierarchy

    GEnum
    ╰── XapianError

Description

Utility functions.

Functions

XAPIAN_GLIB_ENCODE_VERSION()

#define             XAPIAN_GLIB_ENCODE_VERSION(major,minor,micro)

Generates an integer encoded representation of a Xapian-GLib version, useful for compile-time comparisons with XAPIAN_GLIB_VERSION.

Parameters

major

the major version number, e.g. 1

 

minor

the minor version number, e.g. 2

 

micro

the micro version number, e.g. 3

 

xapian_glib_version_string ()

const char *
xapian_glib_version_string (void);

The version string of the Xapian GLib bindings, e.g. "1.2.3"

Returns

the version string.

[transfer none]


xapian_glib_major_version ()

int
xapian_glib_major_version (void);

The major version of the Xapian GLib bindings, e.g. 1 in 1.2.3


xapian_glib_minor_version ()

int
xapian_glib_minor_version (void);

The minor version of the Xapian GLib bindings, e.g. 2 in 1.2.3


xapian_glib_micro_version ()

int
xapian_glib_micro_version (void);

The micro version of the Xapian GLib bindings, e.g. 3 in 1.2.3


xapian_version_string ()

const char *
xapian_version_string (void);

The version string of the underlying Xapian library, e.g. "1.2.17".

Returns

the version string.

[transfer none]


xapian_major_version ()

int
xapian_major_version (void);

The major version of the underlying Xapian library, e.g 1 in 1.2.17.

Returns

the major version


xapian_minor_version ()

int
xapian_minor_version (void);

The minor version of the underlying Xapian library, e.g. 2 in 1.2.17.

Returns

the minor version


xapian_revision ()

int
xapian_revision (void);

The revision number of the underlying Xapian library, e.g. 17 in 1.2.17


xapian_sortable_serialise ()

guchar *
xapian_sortable_serialise (double value,
                           gsize *len);

Convert a floating point number to a string, preserving sort order. The returned string may contain embedded zero bytes, so its length is also returned.

This method converts a floating point number to a string, suitable for using as a value for numeric range restriction, or for use as a sort key.

Parameters

value

The numeric value to serialize

 

len

Used to return the length of the returned string.

[out]

Returns

the serialised value.

[transfer full][array length=len]

Since: 1.4


xapian_sortable_unserialise ()

double
xapian_sortable_unserialise (const guchar *value,
                             gsize len);

Convert a string encoded using sortable_serialise back to a floating point number. The encoded string may contain embedded zero bytes, so its length must also be passed.

This expects the input to be a string produced by xapian_sortable_serialise(). If the input is not such a string, the value returned is undefined (but no error will be thrown).

Parameters

value

The serialized value to be converted.

[array length=len]

len

The length of the serialized value

 

Returns

the unserialised numeric value

Since: 1.4

Types and Values

XAPIAN_ERROR

#define XAPIAN_ERROR                            (xapian_error_quark ())

Error domain for Xapian.


enum XapianError

Error codes for the XAPIAN_ERROR error domain.

Members

XAPIAN_ERROR_ASSERTION

Assertion failure

 

XAPIAN_ERROR_INVALID_ARGUMENT

Invalid argument

 

XAPIAN_ERROR_INVALID_OPERATION

Invalid operation

 

XAPIAN_ERROR_UNIMPLEMENTED

Operation not implemented

 

XAPIAN_ERROR_DATABASE

Database error

 

XAPIAN_ERROR_DATABASE_CORRUPT

Database is corrupt

 

XAPIAN_ERROR_DATABASE_CREATE

Failed to create a database

 

XAPIAN_ERROR_DATABASE_LOCK

Failed to acquire the lock on a database

 

XAPIAN_ERROR_DATABASE_MODIFIED

Database modified after opening

 

XAPIAN_ERROR_DATABASE_OPENING

Unable to open the database

 

XAPIAN_ERROR_DATABASE_VERSION

Version mismatch when opening the database

 

XAPIAN_ERROR_DOC_NOT_FOUND

Document not found

 

XAPIAN_ERROR_FEATURE_UNAVAILABLE

Feature not available with the current backend

 

XAPIAN_ERROR_INTERNAL

Internal state error

 

XAPIAN_ERROR_NETWORK

Network error

 

XAPIAN_ERROR_NETWORK_TIMEOUT

Network timeout error

 

XAPIAN_ERROR_QUERY_PARSER

Error when parsing a query string

 

XAPIAN_ERROR_SERIALISATION

Error when serialising or deserialising data

 

XAPIAN_ERROR_RANGE

Out of bounds access

 

XAPIAN_GLIB_MAJOR_VERSION

#define XAPIAN_GLIB_MAJOR_VERSION            (1)

Evaluates to the major version of the Xapian-GLib version, e.g. 1 if the version is 1.2.3.

Use this macro for compile-time checks.

For run-time checks, use xapian_glib_major_version() instead.


XAPIAN_GLIB_MINOR_VERSION

#define XAPIAN_GLIB_MINOR_VERSION            (6)

Evaluates to the minor version of the Xapian-GLib version, e.g. 2 if the version is 1.2.3.

Use this macro for compile-time checks.

For run-time checks, use xapian_glib_minor_version() instead.


XAPIAN_GLIB_MICRO_VERSION

#define XAPIAN_GLIB_MICRO_VERSION            (1)

Evaluates to the micro version of the Xapian-GLib version, e.g. 3 if the version is 1.2.3.

Use this macro for compile-time checks.

For run-time checks, use xapian_glib_micro_version() instead.


XAPIAN_GLIB_VERSION_S

#define XAPIAN_GLIB_VERSION_S                "1.6.1"

Evaluates to a string with the version of Xapian-GLib, useful for concatenating or for printing.


XAPIAN_GLIB_VERSION

#define             XAPIAN_GLIB_VERSION

Evaluates to an encoded integer representation of the Xapian-GLib version, useful for compile-time version comparisons.

Use XAPIAN_GLIB_ENCODE_VERSION to generate an integer representation that can be compared to the result of this macro, e.g.:

1
2
3
4
5
#if XAPIAN_GLIB_VERSION >= XAPIAN_GLIB_ENCODE_VERSION (1, 2, 3)
  // code that can be used with Xapian-GLib 1.2.3 or later
#elif
  // code that can be used with earlier versions of Xapian-GLib
#endif