Top |
gboolean | xapian_mset_iterator_next () |
gboolean | xapian_mset_iterator_prev () |
gboolean | xapian_mset_iterator_is_valid () |
gboolean | xapian_mset_iterator_is_begin () |
gboolean | xapian_mset_iterator_is_end () |
unsigned int | xapian_mset_iterator_get_rank () |
double | xapian_mset_iterator_get_weight () |
int | xapian_mset_iterator_get_percent () |
XapianDocument * | xapian_mset_iterator_get_document () |
unsigned int | xapian_mset_iterator_get_doc_id () |
unsigned int | xapian_mset_iterator_get_collapse_count () |
char * | xapian_mset_iterator_get_description () |
XapianMSet * | xapian_mset_iterator_get_mset () |
XapianMSetIterator is a class that allows iterating through the items inside a XapianMSet.
A typical example is:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
// retrieve the first 10 results XapianMSet *mset = xapian_enquire_get_mset (enquire, 0, 10, NULL); unsigned int size = xapian_mset_get_size (mset); XapianMSetIterator *iter = xapian_mset_get_begin (mset); while (xapian_mset_iterator_next (iter)) { g_print ("Result %u of %u: %.3f [docid=%u]", xapian_mset_iterator_get_rank (iter) + 1, size, xapian_mset_iterator_get_weight (iter), xapian_mset_iterator_get_doc_id (iter, NULL)); XapianDocument *doc = xapian_mset_iterator_get_document (iter, NULL); // ... use the document } |
gboolean
xapian_mset_iterator_next (XapianMSetIterator *iter
);
Advances the iter
forward.
You should use the return value to check if iter
is still
valid after being advanced, before using the XapianMSetIterator
API.
gboolean
xapian_mset_iterator_prev (XapianMSetIterator *iter
);
Advances the iter
backward.
You should use the return value to check if iter
is still
valid after being advanced, before using the XapianMSetIterator
API.
gboolean
xapian_mset_iterator_is_valid (XapianMSetIterator *iter
);
xapian_mset_iterator_is_valid
has been deprecated since version 1.6 and should not be used in newly-written code.
The iterator is now always valid, so checks using this function can be eliminated.
Prior to 1.6, this function would check whether iter
was valid. However
XapianMSetIterator objects are now always valid, and this function always
returns TRUE
.
gboolean
xapian_mset_iterator_is_begin (XapianMSetIterator *iter
);
Checks if iter
is at the start of the set.
gboolean
xapian_mset_iterator_is_end (XapianMSetIterator *iter
);
Checks if iter
is at the end of the set.
unsigned int
xapian_mset_iterator_get_rank (XapianMSetIterator *iter
);
Retrieves the rank of the current item pointed by iter
.
The rank is the position of the item in the ordered list of results. The rank starts from zero.
double
xapian_mset_iterator_get_weight (XapianMSetIterator *iter
);
Retrieves the weight of the current item pointed by iter
.
int
xapian_mset_iterator_get_percent (XapianMSetIterator *iter
);
Retrieves the weight of the current item pointed by iter
as a percentage between 0 and 100.
XapianDocument * xapian_mset_iterator_get_document (XapianMSetIterator *iter
,GError **error
);
Retrieves the XapianDocument currently pointed by the iterator.
unsigned int xapian_mset_iterator_get_doc_id (XapianMSetIterator *iter
,GError **error
);
Retrieves the id of the document currently pointed by the iterator.
unsigned int
xapian_mset_iterator_get_collapse_count
(XapianMSetIterator *iter
);
Retrieves the estimated number of documents that have been
collapsed into the current item pointed by iter
.
char *
xapian_mset_iterator_get_description (XapianMSetIterator *iter
);
Retrieves a description of iter
, typically used for debugging.
XapianMSet *
xapian_mset_iterator_get_mset (XapianMSetIterator *iter
);
Retrieves the XapianMSet that created the iter
.