21 #ifndef XAPIAN_INCLUDED_HONEY_POSTLIST_ENCODINGS_H
22 #define XAPIAN_INCLUDED_HONEY_POSTLIST_ENCODINGS_H
57 }
else if (termfreq == 2) {
84 if (first_wdf != (collfreq / 2)) {
86 AssertEq(std::max(first_wdf, collfreq - first_wdf), wdf_max);
88 AssertEq(collfreq - first_wdf, wdf_max);
90 }
else if (collfreq == 0) {
95 pack_uint(out, last - first - (termfreq - 1));
101 pack_uint(out, last - first - (termfreq - 1));
105 if (first_wdf >= collfreq - first_wdf - (termfreq - 2)) {
136 chunk_last = last = first;
137 wdf_max = first_wdf = collfreq;
146 chunk_last = last = first + termfreq + 1;
148 first_wdf = collfreq / 2;
149 wdf_max = std::max(first_wdf, collfreq - first_wdf);
160 chunk_last = last = first + termfreq + 1;
162 wdf_max = std::max(first_wdf, collfreq - first_wdf);
170 last += first + termfreq - 1;
174 wdf_max = first_wdf = 0;
176 collfreq += (termfreq - 1);
181 if (first_wdf >= collfreq - first_wdf - (termfreq - 2)) {
187 wdf_max += first_wdf;
240 collfreq += (termfreq - 1);
252 Assert(chunk_first_wdf != 0);
253 pack_uint(out, chunk_last - chunk_first);
267 chunk_first = chunk_last - chunk_first;
277 pack_uint(out, chunk_last - chunk_first);
288 chunk_first = chunk_last - chunk_first;
bool decode_delta_chunk_header(const char **p, const char *end, Xapian::docid chunk_last, Xapian::docid &chunk_first, Xapian::termcount &chunk_first_wdf)
void encode_delta_chunk_header(Xapian::docid chunk_first, Xapian::docid chunk_last, Xapian::termcount chunk_first_wdf, std::string &out)
void encode_delta_chunk_header_no_wdf(Xapian::docid chunk_first, Xapian::docid chunk_last, std::string &out)
bool decode_initial_chunk_header(const char **p, const char *end, Xapian::doccount &termfreq, Xapian::termcount &collfreq, Xapian::docid &first, Xapian::docid &last, Xapian::docid &chunk_last, Xapian::termcount &first_wdf, Xapian::termcount &wdf_max)
bool decode_delta_chunk_header_no_wdf(const char **p, const char *end, Xapian::docid chunk_last, Xapian::docid &chunk_first)
bool decode_initial_chunk_header_freqs(const char **p, const char *end, Xapian::doccount &termfreq, Xapian::termcount &collfreq)
void encode_initial_chunk_header(Xapian::doccount termfreq, Xapian::termcount collfreq, Xapian::docid first, Xapian::docid last, Xapian::docid chunk_last, Xapian::termcount first_wdf, Xapian::termcount wdf_max, std::string &out)
unsigned XAPIAN_TERMCOUNT_BASE_TYPE termcount
A counts of terms.
unsigned XAPIAN_DOCID_BASE_TYPE doccount
A count of documents.
unsigned XAPIAN_DOCID_BASE_TYPE docid
A unique identifier for a document.
#define AssertRel(A, REL, B)
Pack types into strings and unpack them again.
bool unpack_uint(const char **p, const char *end, U *result)
Decode an unsigned integer from a string.
void pack_uint(std::string &s, U value)
Append an encoded unsigned integer to a string.