33 template<
bool FORWARD_DID,
bool CHECK_DID_ZERO>
41 if (a.
did == 0)
return false;
42 if (b.
did == 0)
return true;
51 template<
bool FORWARD_DID>
56 if (a.
wt > b.
wt)
return true;
57 if (a.
wt < b.
wt)
return false;
58 return msetcmp_by_did<FORWARD_DID, true>(a, b);
62 template<
bool FORWARD_VALUE,
bool FORWARD_DID>
69 if (a.
did == 0)
return false;
70 if (b.
did == 0)
return true;
73 if (sort_cmp > 0)
return FORWARD_VALUE;
74 if (sort_cmp < 0)
return !FORWARD_VALUE;
75 return msetcmp_by_did<FORWARD_DID, FORWARD_VALUE>(a, b);
79 template<
bool FORWARD_VALUE,
bool FORWARD_DID>
86 if (a.
did == 0)
return false;
87 if (b.
did == 0)
return true;
90 if (sort_cmp > 0)
return FORWARD_VALUE;
91 if (sort_cmp < 0)
return !FORWARD_VALUE;
92 if (a.
wt > b.
wt)
return true;
93 if (a.
wt < b.
wt)
return false;
94 return msetcmp_by_did<FORWARD_DID, FORWARD_VALUE>(a, b);
98 template<
bool FORWARD_VALUE,
bool FORWARD_DID>
103 if (!FORWARD_VALUE) {
105 if (a.
did == 0)
return false;
106 if (b.
did == 0)
return true;
108 if (a.
wt > b.
wt)
return true;
109 if (a.
wt < b.
wt)
return false;
111 if (sort_cmp > 0)
return FORWARD_VALUE;
112 if (sort_cmp < 0)
return !FORWARD_VALUE;
113 return msetcmp_by_did<FORWARD_DID, FORWARD_VALUE>(a, b);
119 bool sort_val_reverse)
124 return msetcmp_by_relevance<true>;
126 return msetcmp_by_relevance<false>;
129 if (sort_val_reverse) {
130 return msetcmp_by_value<true, true>;
132 return msetcmp_by_value<false, true>;
135 if (sort_val_reverse) {
136 return msetcmp_by_value<true, false>;
138 return msetcmp_by_value<false, false>;
143 if (sort_val_reverse) {
144 return msetcmp_by_value_then_relevance<true, true>;
146 return msetcmp_by_value_then_relevance<false, true>;
149 if (sort_val_reverse) {
150 return msetcmp_by_value_then_relevance<true, false>;
152 return msetcmp_by_value_then_relevance<false, false>;
160 if (sort_val_reverse) {
161 return msetcmp_by_relevance_then_value<true, true>;
163 return msetcmp_by_relevance_then_value<false, true>;
166 if (sort_val_reverse) {
167 return msetcmp_by_relevance_then_value<true, false>;
169 return msetcmp_by_relevance_then_value<false, false>;
static bool msetcmp_by_value_then_relevance(const Xapian::Internal::MSetItem &a, const Xapian::Internal::MSetItem &b)
Xapian::docid did
Document id.
string sort_key
Used when sorting by value.
bool(* MSetCmp)(const Xapian::Internal::MSetItem &, const Xapian::Internal::MSetItem &)
double wt
Weight calculated.
An item resulting from a query.
static bool msetcmp_by_relevance_then_value(const Xapian::Internal::MSetItem &a, const Xapian::Internal::MSetItem &b)
MSetItem comparison functions.
static bool msetcmp_by_relevance(const Xapian::Internal::MSetItem &a, const Xapian::Internal::MSetItem &b)
MSetCmp get_msetcmp_function(Xapian::Enquire::Internal::sort_setting sort_by, bool sort_forward, bool sort_val_reverse)
Select the appropriate msetcmp function.
Various assertion macros.
static bool msetcmp_by_value(const Xapian::Internal::MSetItem &a, const Xapian::Internal::MSetItem &b)
static bool msetcmp_by_did(const Xapian::Internal::MSetItem &a, const Xapian::Internal::MSetItem &b)