|
JASSv2
|
Everything necessary to process a query is encapsulated in an object of this type. More...
#include <query_simple.h>


Public Member Functions | |
| query_simple (compress_integer &codex) | |
| Constructor. | |
| virtual | ~query_simple () |
| Destructor. | |
| virtual void | init (const std::vector< std::string > &primary_keys, DOCID_TYPE documents=1024, DOCID_TYPE top_k=10, size_t width=7) |
| Initialise the object. MUST be called before first use. More... | |
| virtual docid_rsv_pair * | get_first (void) |
| Retrun the top result. More... | |
| virtual docid_rsv_pair * | get_next (void) |
| After calling get_first(), return the next result. More... | |
| virtual void | rewind (ACCUMULATOR_TYPE smallest_possible_rsv=0, ACCUMULATOR_TYPE top_k_lower_bound=1, ACCUMULATOR_TYPE largest_possible_rsv=0) |
| Clear this object after use and ready for re-use in a new query. | |
| virtual void | sort (void) |
| sort this resuls list before iteration over it. | |
| forceinline void | add_rsv (DOCID_TYPE document_id, ACCUMULATOR_TYPE score) |
| Add weight to the rsv for document document_id. More... | |
| virtual void | decode_with_writer (size_t integers, const void *compressed, size_t compressed_size) |
| Given the integer decoder, the number of integes to decode, and the compressed sequence, decompress (but do not process). More... | |
Public Member Functions inherited from JASS::query | |
| query (compress_integer &codex) | |
| Constructor. | |
| virtual | ~query () |
| Destructor. | |
| template<typename STRING_TYPE > | |
| void | parse (const STRING_TYPE &query, parser_query::parser_type which_parser=parser_query::parser_type::query) |
| Take the given query and parse it. More... | |
| query_term_list & | terms (void) |
| Return a reference to the parsed query. More... | |
| forceinline void | set_impact (ACCUMULATOR_TYPE score) |
| Set the impact score to use in a push_back(). More... | |
| forceinline void | decode_and_process (ACCUMULATOR_TYPE impact, size_t integers, const void *compressed, size_t compressed_size) |
| Given the integer decoder, the number of integes to decode, and the compressed sequence, decompress (but do not process). More... | |
| virtual void | decode_with_writer (query::printer &writer, size_t integers, const void *compressed, size_t compressed_size) |
| Given the integer decoder, the number of integes to decode, and the compressed sequence, decompress (but do not process). More... | |
Static Public Member Functions | |
| static void | unittest (void) |
| Unit test this class. | |
Private Attributes | |
| ACCUMULATOR_TYPE | accumulator [MAX_DOCUMENTS] |
| The accumulators, one per document in the collection. | |
| ACCUMULATOR_TYPE * | accumulator_pointer [MAX_DOCUMENTS] |
| Array of pointers to the accumulators. | |
| bool | sorted |
| Has accumulator_pointer been sorted (false after rewind() true after sort()) | |
| docid_rsv_pair | next_result |
| A single result, used but get_first() and get_next() | |
| DOCID_TYPE | next_result_location |
| Used by get_first() and get_next() to determine which result is next. | |
Additional Inherited Members | |
Public Types inherited from JASS::query | |
| typedef uint8_t | ACCUMULATOR_TYPE |
| the type of an accumulator (probably a uint16_t) | |
| typedef uint32_t | DOCID_TYPE |
| the type of a document id (from a compressor) | |
Public Attributes inherited from JASS::query | |
| DOCID_TYPE | top_k |
| The number of results to track. | |
Static Public Attributes inherited from JASS::query | |
| static constexpr size_t | MAX_DOCUMENTS = 200'000'000 |
| the maximum number of documents an index can hold | |
| static constexpr size_t | MAX_TOP_K = 1'000 |
| the maximum top-k value | |
| static constexpr size_t | MAX_RSV = (std::numeric_limits<ACCUMULATOR_TYPE>::max)() |
Protected Attributes inherited from JASS::query | |
| ACCUMULATOR_TYPE | impact |
| The impact score to be added on a call to add_rsv() | |
| allocator_pool | memory |
| All memory allocation happens in this "arena". | |
| std::vector< DOCID_TYPE > | decompress_buffer |
| The delta-encoded decopressed integer sequence. | |
| DOCID_TYPE | documents |
| The numnber of documents this index contains. | |
| parser_query | parser |
| Parser responsible for converting text into a parsed query. | |
| query_term_list * | parsed_query |
| The parsed query. | |
| const std::vector< std::string > * | primary_keys |
| A vector of strings, each the primary key for the document with an id equal to the vector index. | |
| compress_integer & | codex |
| The decompressor to use. | |
Everything necessary to process a query is encapsulated in an object of this type.
|
inline |
Add weight to the rsv for document document_id.
| document_id | [in] which document to increment |
| score | [in] the amount of weight to add |
|
inlinevirtual |
Given the integer decoder, the number of integes to decode, and the compressed sequence, decompress (but do not process).
| integers | [in] The number of integers that are compressed. |
| compressed | [in] The compressed sequence. |
| compressed_size | [in] The length of the compressed sequence. |
Implements JASS::query.
|
inlinevirtual |
Retrun the top result.
Implements JASS::query.
|
inlinevirtual |
After calling get_first(), return the next result.
Implements JASS::query.
|
inlinevirtual |
Initialise the object. MUST be called before first use.
| primary_keys | [in] Vector of the document primary keys used to convert from internal document ids to external primary keys. |
| documents | [in] The number of documents in the collection. |
| top_k | [in] The top-k documents to return from the query once executed. |
| width | [in] Not used |
Reimplemented from JASS::query.
1.8.13