docs: describe BucketFinder
This commit is contained in:
parent
c1b4fc67e9
commit
e4c643880a
2 changed files with 35 additions and 14 deletions
|
@ -10,17 +10,34 @@ private:
|
|||
std::unordered_map<char, WordRefList> directory_;
|
||||
|
||||
public:
|
||||
/// Inserts references to all words from word_list between first_index and
|
||||
/// last_index, including first_index, excluding last_index.
|
||||
void insert(const WordList &word_list, size_t first_index, size_t last_index);
|
||||
|
||||
/// Find all words that start with search_term
|
||||
/// @return A list with references to the results.
|
||||
WordRefList find_prefix(std::string_view search_term) const;
|
||||
};
|
||||
|
||||
/** This class provides efficient, parallel search over a list of strings.
|
||||
*
|
||||
* References to all input strings are stored in a tree-like structure that
|
||||
* provides fast and lock-free parallel insertion and parallel (with minimal
|
||||
* synchronization) search for all words that start with a given term.
|
||||
*/
|
||||
class BucketFinder : public Finder {
|
||||
private:
|
||||
std::vector<Bucket> buckets_;
|
||||
|
||||
public:
|
||||
/// Creates a BucketFinder over all words in word_list.
|
||||
BucketFinder(const WordList &word_list);
|
||||
|
||||
/// Find all words that start with search_term
|
||||
/// @return A list with references to the results.
|
||||
WordRefList find_prefix(std::string_view search_term) const override;
|
||||
|
||||
private:
|
||||
/// Inserts references to all words from word_list.
|
||||
void insert(const WordList &word_list);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue