XapianEnquire

XapianEnquire — Query a database for matching documents

Functions

Properties

XapianDatabase * database Read / Write / Construct Only

Object Hierarchy

    GObject
    ╰── XapianEnquire

Description

XapianEnquire is a class used to perform queries on XapianDatabase.

Typically, you create a new XapianEnquire instance for a specific XapianDatabase (which may contain multiple groups of databases), and assign a XapianQuery to the XapianEnquire instance; then you retrieve the set of matching documents through XapianMSet.

Functions

xapian_enquire_new ()

XapianEnquire *
xapian_enquire_new (XapianDatabase *db,
                    GError **error);

Creates and initializes a new XapianEnquire instance for the given XapianDatabase.

If the initializion failed, error is set, and this function will return NULL.

Parameters

db

a XapianDatabase

 

error

return location for a GError, or NULL

 

Returns

the newly created XapianEnquire instance.

[transfer full]


xapian_enquire_set_query ()

void
xapian_enquire_set_query (XapianEnquire *enquire,
                          XapianQuery *query,
                          unsigned int qlen);

Sets the XapianQuery for the XapianEnquire instance.

Parameters

enquire

a XapianEnquire

 

query

a XapianQuery

 

qlen

the length of the query

 

xapian_enquire_get_query ()

XapianQuery *
xapian_enquire_get_query (XapianEnquire *enquire);

Retrieves the XapianQuery set using xapian_enquire_set_query().

Parameters

enquire

a XapianEnquire

 

Returns

a XapianQuery or NULL if none is set.

[transfer none]


xapian_enquire_set_collapse_key ()

void
xapian_enquire_set_collapse_key (XapianEnquire *enquire,
                                 unsigned int collapse_key);

Sets the collapse key for the XapianEnquire instance with the default collapse_max value of 1.

Parameters

enquire

a XapianEnquire

 

collapse_key

value number to collapse on

 

Since: 1.2


xapian_enquire_set_collapse_key_full ()

void
xapian_enquire_set_collapse_key_full (XapianEnquire *enquire,
                                      unsigned int collapse_key,
                                      unsigned int collapse_max);

Sets the collapse key for the XapianEnquire instance.

Parameters

enquire

a XapianEnquire

 

collapse_key

value number to collapse on

 

collapse_max

Max number of items with the same key to leave after collapsing

 

Since: 1.2


xapian_enquire_set_cutoff ()

void
xapian_enquire_set_cutoff (XapianEnquire *enquire,
                           gfloat percent_cutoff);

Set the percentage cutoffs with no weight cutoff.

Parameters

enquire

a XapianEnquire

 

percent_cutoff

Minimum percentage score for returned documents. If a document has a lower percentage score than this, it will not appear in the MSet.

 

Since: 1.2


xapian_enquire_set_cutoff_full ()

void
xapian_enquire_set_cutoff_full (XapianEnquire *enquire,
                                gfloat percent_cutoff,
                                unsigned int weight_cutoff);

Set the percentage and weight cutoffs.

Parameters

enquire

a XapianEnquire

 

percent_cutoff

Minimum percentage score for returned documents. If a document has a lower percentage score than this, it will not appear in the MSet.

 

weight_cutoff

Minimum weight for a document to be returned. If a document has a lower score that this, it will not appear in the MSet

 

Since: 1.2


xapian_enquire_set_sort_by_value ()

void
xapian_enquire_set_sort_by_value (XapianEnquire *enquire,
                                  unsigned int sort_key,
                                  gboolean reverse);

Set the sorting to be by value only. Note that sorting by values uses a string comparison; to use this function to sort by a numeric value you will have to store the values in a way that sorts appropriately, for instance by padding the numbers using leading zeros — e.g. 001, 002, 003, ....

Parameters

enquire

a XapianEnquire

 

sort_key

value number to sort on.

 

reverse

If true, reverses the sort order.

 

Since: 1.2


xapian_enquire_get_mset ()

XapianMSet *
xapian_enquire_get_mset (XapianEnquire *enquire,
                         unsigned int first,
                         unsigned int max_items,
                         GError **error);

Retrieves max_items items matching the XapianQuery used with the enquire instance.

If first is zero, the first item returned will be the one with the highest score. If non-zero, the value will be the number of items ignored. A combination of first and max_items can be used to paginate the matching results.

In case of error, error will be set, and this function will return NULL.

Parameters

enquire

a XapianEnquire

 

first

the first item in the result set

 

max_items

the maximum number of results to return

 

error

return location for a GError

 

Returns

a XapianMSet containing the matching documents.

[transfer full]

Types and Values

Property Details

The “database” property

  “database”                 XapianDatabase *

The XapianDatabase to query.

Flags: Read / Write / Construct Only