JASSv2
Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Attributes | Friends | List of all members
JASS::index_postings_impact Class Reference

Holder class for an impact ordered postings list. More...

#include <index_postings_impact.h>

Collaboration diagram for JASS::index_postings_impact:
Collaboration graph
[legend]

Classes

class  impact
 Each impact is represented as an impact score, and a start and end pointer. More...
 
class  reverse_iterator
 A reverse iterator for iterating over impact headers from highet to lowest. More...
 

Public Types

typedef uint16_t impact_type
 An impact value (i.e. a term frequency value) is of this type.
 

Public Member Functions

 index_postings_impact (size_t document_count, allocator &memory)
 Constructor. More...
 
void set_impact_count (size_t number_of_impacts)
 Tell this object how many impacts it holds. More...
 
compress_integer::integerget_postings (void)
 Return a pointer to the buffer containing the postings. More...
 
compress_integer::integeroperator[] (size_t index) const
 return a reference to the size_t at position index in the postings array. More...
 
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. More...
 
size_t impact_size (void) const
 Return the number of unique impact scores in the postings list. More...
 
const impactbegin (void) const
 Return a pointer to the first impact header (for use in an iterator). More...
 
const impactend (void) const
 Return a pointer to one element past the end of the impact headers (for use in an iterator). More...
 
const auto rbegin (void) const
 Return a pointer to the last impact header (for use in an reverse iterator). More...
 
const auto rend (void) const
 Return a pointer to one element before the first impact headers (for use in reverse iteration iterator). More...
 
void text_render (std::ostream &stream)
 Dump a human-readable version of the postings list down the stream. More...
 

Static Public Member Functions

static void unittest (void)
 Unit test this class.
 

Static Public Attributes

static constexpr size_t largest_impact = 1024
 The largest allowable immpact score (255 is an good value).
 
static constexpr size_t smallest_impact = 1
 The smallest allowable impact score (normally 1)
 

Protected Attributes

allocatormemory
 All allocation happens in this arena.
 
size_t number_of_impacts
 The number of impact objects in the impacts array.
 
impact impacts [largest_impact+1]
 List of impact pointers (the impact header).
 
size_t number_of_postings
 The length of the postings array measured in size_t.
 
compress_integer::integerpostings
 The list of document IDs, strung together for each postings segment.
 
compress_integer::integerdocument_ids
 The re-used buffer storing decoded document ids - used while impact ordering.
 
index_postings_impact::impact_typeterm_frequencies
 The re-used buffer storing the term frequencies - used while impact ordering.
 
size_t temporary_size
 The number of bytes in temporary.
 
uint8_t * temporary
 Temporary buffer - cannot be used to store anything between calls.
 

Friends

class index_postings
 

Detailed Description

Holder class for an impact ordered postings list.

Constructor & Destructor Documentation

◆ index_postings_impact()

JASS::index_postings_impact::index_postings_impact ( size_t  document_count,
allocator memory 
)
inline

Constructor.

The postings lists are typvically stored <impact><d><d>...<d><0>, The headers point to the list of <d>s (not the <impact> or the <0>.

Parameters
document_count[in] The number of documents in the collection (the length of the longest postings list)
memory[in] All memory allocation happens in this arena

Member Function Documentation

◆ begin()

const impact* JASS::index_postings_impact::begin ( void  ) const
inline

Return a pointer to the first impact header (for use in an iterator).

Returns
A pointer to the first impact header.

◆ end()

const impact* JASS::index_postings_impact::end ( void  ) const
inline

Return a pointer to one element past the end of the impact headers (for use in an iterator).

Returns
A pointer to one element past the end of the impact headers.

◆ get_postings()

compress_integer::integer* JASS::index_postings_impact::get_postings ( void  )
inline

Return a pointer to the buffer containing the postings.

This method should only be called by a method that builds one of these objects.

◆ header()

void JASS::index_postings_impact::header ( size_t  index,
impact_type  score,
compress_integer::integer postings_start,
compress_integer::integer postings_end 
)
inline

Set the value of the impact header object at the given index.

Parameters
index[in] Which header to set
score[in] The impact value for all the documents in this range
postings_start[in] The start of the range of postings that share this impact score
postings_end[in] The end of the range if postings that share this impact score

◆ impact_size()

size_t JASS::index_postings_impact::impact_size ( void  ) const
inline

Return the number of unique impact scores in the postings list.

The number of unique impact scores.

◆ operator[]()

compress_integer::integer& JASS::index_postings_impact::operator[] ( size_t  index) const
inline

return a reference to the size_t at position index in the postings array.

Node taht this is astrict index and not range checked. Access out of range ill resilt in undefined behaviour. The access is to elements in the array so if the postings are stored <impact><d><d>...<d><0> then posting[0] will be the impact score.

Returns
a reference to the size_t at postng[index].

◆ rbegin()

const auto JASS::index_postings_impact::rbegin ( void  ) const
inline

Return a pointer to the last impact header (for use in an reverse iterator).

Returns
A pointer to the first impact header.

◆ rend()

const auto JASS::index_postings_impact::rend ( void  ) const
inline

Return a pointer to one element before the first impact headers (for use in reverse iteration iterator).

Returns
A pointer to one element past the end of the impact headers.

◆ set_impact_count()

void JASS::index_postings_impact::set_impact_count ( size_t  number_of_impacts)
inline

Tell this object how many impacts it holds.

This method should only be called by a method that builds one of these objects.

Parameters
number_of_impacts[in] The number of impact segments this object holds

◆ text_render()

void JASS::index_postings_impact::text_render ( std::ostream &  stream)
inline

Dump a human-readable version of the postings list down the stream.

Parameters
stream[in] The stream to write to.

The documentation for this class was generated from the following file: