pub struct Index {
pub meta: SearchIndexMeta,
pub concepts: Vec<Concept>,
pub semantic_types: HashMap<u16, SemanticType>,
/* private fields */
}Fields§
§meta: SearchIndexMeta§concepts: Vec<Concept>§semantic_types: HashMap<u16, SemanticType>Implementations§
source§impl Index
impl Index
pub fn new(base_dir: &Path) -> Result<Index>
sourcepub fn load_semantic_types(
base_dir: &Path
) -> Result<HashMap<u16, SemanticType>>
pub fn load_semantic_types( base_dir: &Path ) -> Result<HashMap<u16, SemanticType>>
Read the semantic types list from disk.
sourcepub fn load_concepts(base_dir: &Path) -> Result<Vec<Concept>>
pub fn load_concepts(base_dir: &Path) -> Result<Vec<Concept>>
Read the concepts list from disk.
sourcepub fn concept_id(&self, id: u64) -> &Concept
pub fn concept_id(&self, id: u64) -> &Concept
Get the string associated with an ID returned from the search function.
sourcepub fn search(&self, word: &str) -> Result<Option<u64>>
pub fn search(&self, word: &str) -> Result<Option<u64>>
Find a word in a case-insensitive fashion. For indexes built in case-insensitive mode, this does a simple get. Otherwise it builds an automata that searches the index in a case-insensitive fashion.
sourcepub fn search_exact(&self, word: &str) -> Option<u64>
pub fn search_exact(&self, word: &str) -> Option<u64>
Find an exact match for the given word.
sourcepub fn search_regex(&self, word: &str) -> Result<Option<u64>>
pub fn search_regex(&self, word: &str) -> Result<Option<u64>>
Search for a word using a regex pattern.
pub fn fuzzy_search( &self, word: &str, levenshtein: u32 ) -> Result<StreamWithState<'_, Levenshtein>>
pub fn downstream_codes<'a>( &'a self, start_concept_id: u32, code_types: &'a [impl AsRef<str> + PartialEq] ) -> impl Iterator<Item = (usize, &'a ConceptCode)>
Auto Trait Implementations§
impl RefUnwindSafe for Index
impl Send for Index
impl Sync for Index
impl Unpin for Index
impl UnwindSafe for Index
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more