A read-only view of a B+-tree-like structure that stores the vocabulary for an index.
More...
#include <vocabulary_map.h>
|
int | compare (const std::string &term, const char *other) const |
| Convenience wrapper for comparing the term with strings in the tree. More...
|
|
A read-only view of a B+-tree-like structure that stores the vocabulary for an index.
It reads the file format that is written by the vocabulary_map_writer class (see the documentation for the writer for information about the file format).
meta::index::vocabulary_map::vocabulary_map |
( |
const std::string & |
path, |
|
|
uint16_t |
block_size = 4096 |
|
) |
| |
Creates a vocabulary map reading the file in the given path with the given block size.
Changing the block size is not recommended—the block size used should always be the same as the block size used in the vocabulary_map_writer used to create the tree.
- Parameters
-
path | the location of the tree file |
block_size | the size of the nodes in the tree |
int meta::index::vocabulary_map::compare |
( |
const std::string & |
term, |
|
|
const char * |
other |
|
) |
| const |
|
private |
Convenience wrapper for comparing the term with strings in the tree.
- Parameters
-
term | the term we are looking for |
other | the string in the tree we are considering |
util::optional< term_id > meta::index::vocabulary_map::find |
( |
const std::string & |
term | ) |
const |
Finds the given term in the tree, if it exists.
- Parameters
-
term | the term to find an id for |
std::string meta::index::vocabulary_map::find_term |
( |
term_id |
t_id | ) |
const |
Finds the term associated with the given id.
No bounds checking is performed—accessing beyond the maximum assigned term_id is undefined behavior.
- Parameters
-
t_id | the term id to find the string representation of |
The file containing the tree.
mmapped for performance.
uint64_t meta::index::vocabulary_map::leaf_end_pos_ |
|
private |
The ending position of the leaf nodes.
Used to determine when to stop a search.
uint64_t meta::index::vocabulary_map::initial_seek_pos_ |
|
private |
The position of the first internal node that is not the root.
Used to seek to the first level during search.
The documentation for this class was generated from the following files:
- /home/chase/projects/meta/include/index/vocabulary_map.h
- /home/chase/projects/meta/src/index/vocabulary_map.cpp