38 static constexpr
size_t largest_impact = std::numeric_limits<impact_type>::max();
42 static constexpr
size_t largest_impact = 1024;
43 static constexpr
size_t smallest_impact = 1;
156 return address != other.
address;
210 number_of_impacts(0),
211 number_of_postings(document_count),
212 postings(static_cast<decltype(postings)>(memory.malloc((document_count + largest_impact + 1) * sizeof(*postings)))),
213 document_ids((decltype(document_ids))memory.malloc(document_count * sizeof(*document_ids))),
214 term_frequencies((decltype(term_frequencies))memory.malloc(document_count * sizeof(*term_frequencies))),
215 temporary_size(document_count * (sizeof(*document_ids) / 7 + 1) * sizeof(*temporary)),
216 temporary((decltype(temporary))memory.malloc(temporary_size))
261 return postings[index];
279 impacts[index].
start = postings_start;
280 impacts[index].
finish = postings_end;
359 for (
const auto &
header : *
this)
361 stream <<
header.impact_score <<
":";
368 stream << postings[index] <<
" ";
401 postings.
header(0, 255, &postings[1], &postings[2]);
402 postings.
header(1, 128, &postings[4], &postings[6]);
409 JASS_assert(memcmp(&postings[0], answer,
sizeof(answer)) == 0);
425 std::string serialised_answer =
"255:10 \n128:2 5 \n";
426 std::stringstream output;
427 for (
const auto &
header : postings)
429 output << static_cast<int>(
header.impact_score) <<
":";
437 puts(
"index_postings_impact::PASSED");
Non-thread-safe object that accumulates a single postings list during indexing.
Definition: index_postings.h:40
impact_type impact_score
The impact score.
Definition: index_postings_impact.h:57
void header(size_t index, impact_type score, compress_integer::integer *postings_start, compress_integer::integer *postings_end)
Set the value of the impact header object at the given index.
Definition: index_postings_impact.h:276
void set_impact_count(size_t number_of_impacts)
Tell this object how many impacts it holds.
Definition: index_postings_impact.h:230
A <docid, tf> tuple.
Definition: posting.h:28
const impact * begin(void) const
Return a pointer to the first impact header (for use in an iterator).
Definition: index_postings_impact.h:304
static void unittest(void)
Unit test this class.
Definition: index_postings_impact.h:382
void text_render(std::ostream &stream)
Dump a human-readable version of the postings list down the stream.
Definition: index_postings_impact.h:356
const auto rbegin(void) const
Return a pointer to the last impact header (for use in an reverse iterator).
Definition: index_postings_impact.h:330
size_t number_of_postings
The length of the postings array measured in size_t.
Definition: index_postings_impact.h:189
uint32_t integer
This class and descendants will work on integers of this size. Do not change without also changing JA...
Definition: compress_integer.h:40
#define JASS_assert(expression)
Drop in replacement for assert() that aborts in Release as well as Debug.
Definition: asserts.h:33
impact * address
Which header we're pointing at.
Definition: index_postings_impact.h:128
const auto rend(void) const
Return a pointer to one element before the first impact headers (for use in reverse iteration iterato...
Definition: index_postings_impact.h:343
Compression codexes for integer sequences.
compress_integer::integer * postings
The list of document IDs, strung together for each postings segment.
Definition: index_postings_impact.h:190
Each impact is represented as an impact score, and a start and end pointer.
Definition: index_postings_impact.h:54
A reverse iterator for iterating over impact headers from highet to lowest.
Definition: index_postings_impact.h:125
impact & operator*()
Return a reference to the element pointed to by this iterator.
Definition: index_postings_impact.h:166
compress_integer::integer * end(void) const
Return a pointer to the end of the document identifiers array (for use as an iterator).
Definition: index_postings_impact.h:98
impact impacts[largest_impact+1]
List of impact pointers (the impact header).
Definition: index_postings_impact.h:188
index_postings_impact(size_t document_count, allocator &memory)
Constructor.
Definition: index_postings_impact.h:208
Holder class for an impact ordered postings list.
Definition: index_postings_impact.h:31
size_t temporary_size
The number of bytes in temporary.
Definition: index_postings_impact.h:193
static constexpr size_t largest_impact
The largest allowable immpact score (255 is an good value).
Definition: index_postings_impact.h:42
compress_integer::integer * begin(void) const
Return a pointer to the start of the document identifiers array (for use as an iterator).
Definition: index_postings_impact.h:85
uint8_t * temporary
Temporary buffer - cannot be used to store anything between calls.
Definition: index_postings_impact.h:194
const impact * end(void) const
Return a pointer to one element past the end of the impact headers (for use in an iterator)...
Definition: index_postings_impact.h:317
Simple block-allocator that internally allocates a large chunk then allocates smaller blocks from thi...
Definition: allocator_pool.h:61
Virtual base class for C style allocators.
Definition: allocator.h:33
compress_integer::integer * start
Pointer into the postings of the start of the document list for this impact score.
Definition: index_postings_impact.h:58
const reverse_iterator & operator++()
Increment this iterator.
Definition: index_postings_impact.h:178
compress_integer::integer * finish
Pointer into the postings of the end of the document list for this impact score.
Definition: index_postings_impact.h:59
Definition: document_id.h:16
uint16_t impact_type
An impact value (i.e. a term frequency value) is of this type.
Definition: index_postings_impact.h:41
bool operator!=(const reverse_iterator &other) const
Compare two iterator objects for non-equality.
Definition: index_postings_impact.h:154
allocator & memory
All allocation happens in this arena.
Definition: index_postings_impact.h:186
Base class for different allocators.
Definition: compress_integer_elias_delta_simd.c:23
compress_integer::integer * document_ids
The re-used buffer storing decoded document ids - used while impact ordering.
Definition: index_postings_impact.h:191
static std::ostream & operator<<(std::ostream &output, JASS_anytime_stats &data)
Dump a human readable version of the data down an output stream.
Definition: JASS_anytime_stats.h:62
compress_integer::integer size(void) const
Return the numner of postings with this impact score.
Definition: index_postings_impact.h:111
reverse_iterator(impact *address)
Constructor.
Definition: index_postings_impact.h:139
index_postings_impact::impact_type * term_frequencies
The re-used buffer storing the term frequencies - used while impact ordering.
Definition: index_postings_impact.h:192
size_t impact_size(void) const
Return the number of unique impact scores in the postings list.
Definition: index_postings_impact.h:291
impact()
Constructor.
Definition: index_postings_impact.h:68
size_t number_of_impacts
The number of impact objects in the impacts array.
Definition: index_postings_impact.h:187
compress_integer::integer * get_postings(void)
Return a pointer to the buffer containing the postings.
Definition: index_postings_impact.h:243
compress_integer::integer & operator[](size_t index) const
return a reference to the size_t at position index in the postings array.
Definition: index_postings_impact.h:259
static constexpr size_t smallest_impact
The smallest allowable impact score (normally 1)
Definition: index_postings_impact.h:43