#include <enquire.h>
Collaboration diagram for Xapian::Enquire:
Public Types | |
enum | docid_order { ASCENDING = 1, DESCENDING = 0, DONT_CARE = 2 } |
Public Member Functions | |
Enquire (const Database &databases, ErrorHandler *errorhandler_=0) | |
Create a Xapian::Enquire object. | |
~Enquire () | |
Close the Xapian::Enquire object. | |
void | set_query (const Xapian::Query &query, Xapian::termcount qlen=0) |
Set the query to run. | |
const Xapian::Query & | get_query () |
Get the query which has been set. | |
void | set_weighting_scheme (const Weight &weight_) |
Set the weighting scheme to use for queries. | |
void | set_collapse_key (Xapian::valueno collapse_key) |
Set the collapse key to use for queries. | |
void | set_docid_order (docid_order order) |
Set the direction in which documents are ordered by document id in the returned MSet. | |
XAPIAN_DEPRECATED (void set_sort_forward(bool sort_forward)) | |
For compatibility with Xapian 0.8.5 and earlier. | |
void | set_cutoff (Xapian::percent percent_cutoff, Xapian::weight weight_cutoff=0) |
Set the percentage and/or weight cutoffs. | |
XAPIAN_DEPRECATED (void set_sorting(Xapian::valueno sort_key, int sort_bands, bool sort_by_relevance=false)) | |
For compatibility with Xapian 0.8.5 and earlier. | |
void | set_sort_by_relevance () |
Set the sorting to be by relevance only. | |
void | set_sort_by_value (Xapian::valueno sort_key, bool ascending=true) |
Set the sorting to be by value only. | |
void | set_sort_by_value_then_relevance (Xapian::valueno sort_key, bool ascending=true) |
Set the sorting to be by value, then by relevance for documents with the same value. | |
void | set_sort_by_relevance_then_value (Xapian::valueno sort_key, bool ascending=true) |
Set the sorting to be by relevance then value. | |
void | set_bias (Xapian::weight bias_weight, time_t bias_halflife) |
Set the bias functor parameters. | |
MSet | get_mset (Xapian::doccount first, Xapian::doccount maxitems, Xapian::doccount checkatleast=0, const RSet *omrset=0, const MatchDecider *mdecider=0) const |
Get (a portion of) the match set for the current query. | |
MSet | get_mset (Xapian::doccount first, Xapian::doccount maxitems, const RSet *omrset, const MatchDecider *mdecider=0) const |
ESet | get_eset (Xapian::termcount maxitems, const RSet &omrset, int flags=0, double k=1.0, const Xapian::ExpandDecider *edecider=0) const |
Get the expand set for the given rset. | |
ESet | get_eset (Xapian::termcount maxitems, const RSet &omrset, const Xapian::ExpandDecider *edecider) const |
Get the expand set for the given rset. | |
TermIterator | get_matching_terms_begin (Xapian::docid did) const |
Get terms which match a given document, by document id. | |
TermIterator | get_matching_terms_end (Xapian::docid) const |
End iterator corresponding to get_matching_terms_begin(). | |
TermIterator | get_matching_terms_begin (const MSetIterator &it) const |
Get terms which match a given document, by match set item. | |
TermIterator | get_matching_terms_end (const MSetIterator &) const |
End iterator corresponding to get_matching_terms_begin(). | |
void | register_match_decider (const std::string &name, const MatchDecider *mdecider=NULL) |
Register a MatchDecider. | |
std::string | get_description () const |
Introspection method. | |
Public Attributes | |
Xapian::Internal::RefCntPtr< Internal > | internal |
Static Public Attributes | |
static const int | include_query_terms = 1 |
static const int | use_exact_termfreq = 2 |
Databases are usually opened lazily, so exceptions may not be thrown where you would expect them to be. You should catch Xapian::Error exceptions when calling any method in Xapian::Enquire.
Xapian::InvalidArgumentError | will be thrown if an invalid argument is supplied, for example, an unknown database type. |
|
Create a Xapian::Enquire object. This specification cannot be changed once the Xapian::Enquire is opened: you must create a new Xapian::Enquire object to access a different database, or set of databases.
|
|
Close the Xapian::Enquire object.
|
|
Introspection method.
|
|
Get the expand set for the given rset.
|
|
Get the expand set for the given rset.
|
|
Get terms which match a given document, by match set item. This method returns the terms in the current query which match the given document. If the underlying database has suitable support, using this call (rather than passing a Xapian::docid) will enable the system to ensure that the correct data is returned, and that the document has not been deleted or changed since the query was performed.
|
|
Get terms which match a given document, by document id. This method returns the terms in the current query which match the given document. It is possible for the document to have been removed from the database between the time it is returned in an mset, and the time that this call is made. If possible, you should specify an MSetIterator instead of a Xapian::docid, since this will enable database backends with suitable support to prevent this occurring. Note that a query does not need to have been run in order to make this call.
|
|
End iterator corresponding to get_matching_terms_begin().
|
|
End iterator corresponding to get_matching_terms_begin().
|
|
Get (a portion of) the match set for the current query.
|
|
Get the query which has been set. This is only valid after set_query() has been called.
|
|
Register a MatchDecider.
|
|
Set the bias functor parameters. NB this is a temporary API for this feature.
|
|
Set the collapse key to use for queries.
An example use might be to create a value for each document containing an MD5 hash of the document contents. Then duplicate documents from different sources can be eliminated at search time (it's better to eliminate duplicates at index time, but this may not be always be possible - for example the search may be over more than one Xapian database). Another use is to group matches in a particular category (e.g. you might collapse a mailing list search on the Subject: so that there's only one result per discussion thread). In this case you can use get_collapse_count() to give the user some idea how many other results there are. And if you index the Subject: as a boolean term as well as putting it in a value, you can offer a link to a non-collapsed search restricted to that thread using a boolean filter. (default is Xapian::valueno(-1) which means no collapsing). |
|
Set the percentage and/or weight cutoffs.
|
|
Set the direction in which documents are ordered by document id in the returned MSet. This order only has an effect on documents which would otherwise have equal rank. For a weighted probabilistic match with no sort value, this means documents with equal weight. For a boolean match, with no sort value, this means all documents. And if a sort value is used, this means documents with equal sort value (and also equal weight if ordering on relevance after the sort).
|
|
Set the query to run.
|
|
Set the sorting to be by relevance only.
|
|
Set the sorting to be by relevance then value. Note that with the default BM25 weighting scheme parameters, non-identical documents will rarely have the same weight, so this setting will give very similar results to set_sort_by_relevance(). It becomes more useful with particular BM25 parameter settings (e.g. BM25Weight(1,0,1,0,0)) or custom weighting schemes.
|
|
Set the sorting to be by value only.
|
|
Set the sorting to be by value, then by relevance for documents with the same value.
|
|
Set the weighting scheme to use for queries.
|
|
For compatibility with Xapian 0.8.5 and earlier.
set_sorting(KEY, 1, false) -> set_sort_by_value(KEY) set_sorting(KEY, 1, true) -> set_sort_by_value_then_relevance(KEY) set_sorting(ANYTHING, 0) -> set_sort_by_relevance() set_sorting(Xapian::valueno(-1), ANYTHING) -> set_sort_by_relevance() |
|
For compatibility with Xapian 0.8.5 and earlier.
|