indicium/simple/max_keys_per_keyword.rs
1use crate::simple::search_index::SearchIndex;
2
3// -----------------------------------------------------------------------------
4
5impl<K: Ord> SearchIndex<K> {
6 // -------------------------------------------------------------------------
7 //
8 /// If there are too many records attached to a single keyword, performance
9 /// can begin to degrade, so there is a setting that limits the number of
10 /// keys that may be attached to a keyword. This function returns the
11 /// `maximum_keys_per_keyword` setting from the search index.
12 ///
13 /// Basic usage:
14 ///
15 /// ```rust
16 /// # use indicium::simple::SearchIndex;
17 /// # use pretty_assertions::assert_eq;
18 /// #
19 /// # let mut search_index: SearchIndex<usize> = SearchIndex::default();
20 /// #
21 /// assert_eq!(search_index.max_keys_per_keyword(), 40_960);
22 /// ```
23
24 #[tracing::instrument(level = "trace", name = "get maximum keys per keyword", skip(self))]
25 pub fn max_keys_per_keyword(&self) -> usize {
26 self.maximum_keys_per_keyword
27 } // fn
28} // impl