JASSv2
quantize_none.h
Go to the documentation of this file.
1 /*
2  QUANTIZE_NONE.H
3  ---------------
4  Copyright (c) 2018 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 "quantize.h"
16 
17 namespace JASS
18  {
19  /*
20  CLASS QUANTIZE_NONE
21  -------------------
22  */
26  template <typename RANKER>
27  class quantize_none : public quantize<RANKER>
28  {
29  public:
30  /*
31  QUANTIZE_NONE::QUANTIZE_NONE()
32  ------------------------------
33  */
39  quantize_none(size_t documents, std::shared_ptr<RANKER> ranker) :
40  quantize<RANKER>(documents, ranker)
41  {
42  /* Nothing. */
43  }
44 
45  /*
46  QUANTIZE_NONE::~QUANTIZE_NONE()
47  -------------------------------
48  */
52  virtual ~quantize_none()
53  {
54  /* Nothing */
55  }
56 
57  /*
58  QUANTIZE_NONE::OPERATOR()()
59  ---------------------------
60  */
69  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)
70  {
71  /* Nothing. */
72  }
73 
74  /*
75  QUANTIZE_NONE::OPERATOR()()
76  ---------------------------
77  */
87  virtual void operator()(index_manager::delegate &writer, const slice &term, const index_postings &postings, compress_integer::integer document_frequency, compress_integer::integer *document_ids, index_postings_impact::impact_type *term_frequencies)
88  {
89  /*
90  Pass the lisat straight to the writer.
91  */
92  writer(term, postings, document_frequency, document_ids, term_frequencies);
93  }
94 
95  /*
96  QUANTIZE_NONE::OPERATOR()()
97  ---------------------------
98  */
105  virtual void operator()(index_manager::delegate &writer, size_t document_id, const slice &primary_key)
106  {
107  writer(document_id, primary_key);
108  }
109 
110  /*
111  QUANTIZE_NONE::UNITTEST()
112  -------------------------
113  */
117  static void unittest(void)
118  {
119  /*
120  As we do nothing, we automatically pass!
121  */
122  puts("quantize_none::PASSED");
123  }
124  };
125  }
Quantize an index.
Definition: quantize.h:42
Non-thread-safe object that accumulates a single postings list during indexing.
Definition: index_postings.h:40
static void unittest(void)
Unit test this class.
Definition: quantize_none.h:117
C++ slices (string-descriptors)
Definition: slice.h:27
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 for each postings list is operator().
Definition: quantize_none.h:69
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
virtual void operator()(index_manager::delegate &writer, 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 for each postings list is operator().
Definition: quantize_none.h:87
virtual void operator()(index_manager::delegate &writer, size_t document_id, const slice &primary_key)
The callback function for primary keys (external document ids) is operator(). Not needed for quantiza...
Definition: quantize_none.h:105
Do not quantize the in-memory index (i.e. generate a tf-ordered index)
Definition: quantize_none.h:27
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
virtual ~quantize_none()
Destructor.
Definition: quantize_none.h:52
size_t documents
The number of documents in the collection.
Definition: index_manager.h:50
Quantize the in-memory index.
Base class for the callback function called by iterate.
Definition: index_manager.h:47
Definition: compress_integer_elias_delta_simd.c:23
std::shared_ptr< RANKER > ranker
The ranker to use for quantization.
Definition: quantize.h:47
quantize_none(size_t documents, std::shared_ptr< RANKER > ranker)
Constructor.
Definition: quantize_none.h:39