Struct umls::index::Index

source ·
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

source

pub fn new(base_dir: &Path) -> Result<Index>

source

pub fn load_semantic_types( base_dir: &Path ) -> Result<HashMap<u16, SemanticType>>

Read the semantic types list from disk.

source

pub fn load_concepts(base_dir: &Path) -> Result<Vec<Concept>>

Read the concepts list from disk.

source

pub fn concept_id(&self, id: u64) -> &Concept

Get the string associated with an ID returned from the search function.

source

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.

source

pub fn search_exact(&self, word: &str) -> Option<u64>

Find an exact match for the given word.

source

pub fn search_regex(&self, word: &str) -> Result<Option<u64>>

Search for a word using a regex pattern.

source

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> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.