JASSv2
serialise_forward_index.h
Go to the documentation of this file.
1 /*
2  SERIALISE_FORWARD_INDEX.H
3  -------------------------
4  Copyright (c) 2019 Andrew Trotman
5  Released under the 2-clause BSD license (See:https://en.wikipedia.org/wiki/BSD_licenses)
6  */
13 #pragma once
14 
15 #include "file.h"
16 #include "index_manager.h"
17 
18 namespace JASS
19  {
20  /*
21  CLASS SERIALISE_FORWARD_INDEX
22  -----------------------------
23  */
28  {
29  private:
30  std::vector<std::ostringstream> document;
31 
32  public:
33  serialise_forward_index() = delete;
34  /*
35  SERIALISE_FORWARD_INDEX::SERIALISE_FORWARD_INDEX()
36  --------------------------------------------------
37  */
43 
44  /*
45  SERIALISE_FORWARD_INDEX::~SERIALISE_FORWARD_INDEX()
46  ---------------------------------------------------
47  */
52  {
53  /* Nothing */
54  }
55 
56  /*
57  SERIALISE_FORWARD_INDEX::FINISH()
58  ---------------------------------
59  */
63  void finish(void);
64 
65  /*
66  SERIALISE_FORWARD_INDEX::DELEGATE::OPERATOR()()
67  -----------------------------------------------
68  */
77  virtual void operator()(const slice &term, const index_postings &postings, compress_integer::integer document_frequency, compress_integer::integer *document_ids, index_postings_impact::impact_type *term_frequencies);
78 
79  /*
80  SERIALISE_FORWARD_INDEX::DELEGATE::OPERATOR()()
81  -----------------------------------------------
82  */
88  virtual void operator()(size_t document_id, const slice &primary_key);
89 
90  /*
91  SERIALISE_FORWARD_INDEX::UNITTEST()
92  -----------------------------------
93  */
97  static void unittest(void);
98  };
99  }
virtual void operator()(const slice &term, const index_postings &postings, compress_integer::integer document_frequency, compress_integer::integer *document_ids, index_postings_impact::impact_type *term_frequencies)
The callback function to serialise the postings (given the term) is operator().
Definition: serialise_forward_index.cpp:65
Non-thread-safe object that accumulates a single postings list during indexing.
Definition: index_postings.h:40
C++ slices (string-descriptors)
Definition: slice.h:27
~serialise_forward_index()
Definition: serialise_forward_index.h:51
Base class for the indexer object that stored the actual index during indexing.
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
Partial file and whole file based I/O methods.
Serialse an index into a forward index in XML.
Definition: serialise_forward_index.h:27
std::vector< std::ostringstream > document
Each document is represented as a string.
Definition: serialise_forward_index.h:30
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
size_t documents
The number of documents in the collection.
Definition: index_manager.h:50
Base class for the callback function called by iterate.
Definition: index_manager.h:47
Definition: compress_integer_elias_delta_simd.c:23
static void unittest(void)
Unit test this class.
Definition: serialise_forward_index.cpp:85
void finish(void)
Definition: serialise_forward_index.cpp:32