XapianQuery

XapianQuery — A query tree

Functions

Types and Values

Object Hierarchy

    GEnum
    ╰── XapianQueryOp
    GObject
    ╰── XapianQuery

Description

XapianQuery is a class that represents a tree of terms and operations that is applied by XapianEnquire to match documents in a database.

Typically, you'll want to use XapianQueryParser instead of building a XapianQuery directly.

Functions

xapian_query_new ()

XapianQuery *
xapian_query_new (void);

Creates a new, empty XapianQuery instance.

Returns

the newly created XapianQuery instance.

[transfer full]


xapian_query_new_for_term ()

XapianQuery *
xapian_query_new_for_term (const char *term);

Creates a new XapianQuery for the given term .

Parameters

term

the term to query

 

Returns

the newly created XapianQuery instance.

[transfer full]


xapian_query_new_for_pair ()

XapianQuery *
xapian_query_new_for_pair (XapianQueryOp op,
                           XapianQuery *a,
                           XapianQuery *b);

Creates a new XapianQuery using two XapianQuery instances and an op between the two.

Parameters

op

a XapianQueryOp

 

a

a XapianQuery

 

b

a XapianQuery

 

Returns

the newly created XapianQuery instance.

[transfer full]


xapian_query_new_for_value ()

XapianQuery *
xapian_query_new_for_value (XapianQueryOp op,
                            unsigned int slot,
                            const char *value);

Creates a new XapianQuery that matches values from a document value slot.

Parameters

op

a XapianQueryOp value, currently either XAPIAN_QUERY_OP_VALUE_GE or XAPIAN_QUERY_OP_VALUE_LE

 

slot

the slot number to get the value from

 

value

the value to compare

 

Returns

the newly creates XapianQuery.

[transfer full]


xapian_query_new_for_terms_pair ()

XapianQuery *
xapian_query_new_for_terms_pair (XapianQueryOp op,
                                 const char *a,
                                 const char *b);

Creates a new XapianQuery for the two given terms, using the given operator.

Parameters

op

a XapianQueryOp value

 

a

the left hand side term

 

b

the right hand side term

 

Returns

the newly created XapianQuery.

[transfer full]


xapian_query_new_from_posting_source ()

XapianQuery *
xapian_query_new_from_posting_source (XapianPostingSource *posting_source);

Creates a new XapianQuery from a posting source.

Parameters

posting_source

a posting source

 

Returns

the newly created XapianQuery instance.

[transfer full]

Since: 1.2


xapian_query_new_from_string ()

XapianQuery *
xapian_query_new_from_string (const char *data);

Creates a new XapianQuery from its normal form.

Parameters

data

a string containing a query in normal form, as returned by xapian_query_serialise()

 

Returns

the newly created XapianQuery instance.

[transfer full]


xapian_query_new_match_all ()

XapianQuery *
xapian_query_new_match_all (void);

Creates a new XapianQuery that will match all documents in the database.

Returns

the newly created XapianQuery instance.

[transfer full]

Since: 1.2


xapian_query_is_empty ()

gboolean
xapian_query_is_empty (XapianQuery *query);

Checks whether query is empty.

Parameters

query

a XapianQuery

 

Returns

TRUE if the XapianQuery is empty


xapian_query_get_length ()

unsigned int
xapian_query_get_length (XapianQuery *query);

Retrieves the length of the query.

Parameters

query

a XapianQuery

 

Returns

the length of the query


xapian_query_get_description ()

char *
xapian_query_get_description (XapianQuery *query);

Retrieves a description of query , typically used for debugging.

Parameters

query

a XapianQuery

 

Returns

a string with a description of the query.

[transfer full]


xapian_query_serialise ()

char *
xapian_query_serialise (XapianQuery *query);

Serialises query into a normal form that can be used with xapian_query_new_from_string().

Parameters

query

a XapianQuery

 

Returns

the query in normal form.

[transfer full]

Types and Values

enum XapianQueryOp

Operators for XapianQuery.

Members

XAPIAN_QUERY_OP_AND

filters if both sub-queries are satisfied

 

XAPIAN_QUERY_OP_OR

filters if either sub-queries are satisfied

 

XAPIAN_QUERY_OP_AND_NOT

filters if only the left sub-query is satisfied but not the right

 

XAPIAN_QUERY_OP_XOR

filters if either sub-query is satisfied but not both

 

XAPIAN_QUERY_OP_AND_MAYBE

filters if left sub-query is satisfied but uses the weights for both

 

XAPIAN_QUERY_OP_FILTER

filters as XAPIAN_QUERY_OP_AND, but uses only weights from the left sub-query

 

XAPIAN_QUERY_OP_NEAR

filters if occurrances of a list of terms appear within a specified window of positions

 

XAPIAN_QUERY_OP_PHRASE

filters if occurrances of a list of terms appear both within a specified window of positions and als in the specified order

 

XAPIAN_QUERY_OP_VALUE_RANGE

filters by a range of values

 

XAPIAN_QUERY_OP_SCALE_WEIGHT

scales the weight of a sub-query by the specified factor

 

XAPIAN_QUERY_OP_ELITE_SET

picks the best N sub-queries and combines them with XAPIAN_QUERY_OP_OR

 

XAPIAN_QUERY_OP_VALUE_GE

filters a document value using a greater than or equal test

 

XAPIAN_QUERY_OP_VALUE_LE

filters a document value using a less than or equal test

 

XAPIAN_QUERY_OP_SYNONYM

treats a set of sub-queries as synonyms

 

XAPIAN_QUERY_OP_MAX

pick the maximum weight of any subquery (Since: 1.4.0)

 

XAPIAN_QUERY_OP_WILDCARD

wildcard expansion (Since: 1.4.0)