pub struct Table { /* private fields */ }
Expand description
Wraps a crate::ig::docs::Doc and permits to execute fast lookups backed by a Trie.
Note that this is the work horse of the InfoGraphDB.
Implementations§
source§impl Table
impl Table
sourcepub fn new(doc: Doc, indices: Vec<IndexType>) -> Result<Self>
pub fn new(doc: Doc, indices: Vec<IndexType>) -> Result<Self>
Creates a new table from the given doc while building a lookup index for the given paths.
Note that each value in indices
can be a path like field.inner.other
.
sourcepub fn compile(&self, query: impl AsRef<str>) -> Query
pub fn compile(&self, query: impl AsRef<str>) -> Query
Compiles the given field or path name into a fast lookup query which extracts the matching value from a given doc.
sourcepub fn query<'a>(
&'a self,
fields: &'a str,
value: &'a str,
exact: bool
) -> Result<TableIter<'a>>
pub fn query<'a>( &'a self, fields: &'a str, value: &'a str, exact: bool ) -> Result<TableIter<'a>>
Executes a query by searching for the given value in the given list of fields
(see determine_search_fields
).
If exact
is true, the given value must match the field contents, otherwise it can also
be a token or even the prefix of a token within the exact or loose index values of the
selected fields.
Returns an iterator which yields all matching docs or an error, if a search query is executed against non-indexed fields.
sourcepub fn table_scan(&self) -> TableIter<'_> ⓘ
pub fn table_scan(&self) -> TableIter<'_> ⓘ
Performs a table scan which simply iterates over all rows of a table.
sourcepub fn num_queries(&self) -> usize
pub fn num_queries(&self) -> usize
Returns the number of queries which have been executed against this table.
sourcepub fn num_scan_queries(&self) -> usize
pub fn num_scan_queries(&self) -> usize
Returns the number of queries which have resorted to a table scan in order to execute properly.
sourcepub fn allocated_memory(&self) -> usize
pub fn allocated_memory(&self) -> usize
Estimates the allocated memory for both, the table data and its index.
The returned value is in bytes.
sourcepub fn default_lang_query(&self) -> &Query
pub fn default_lang_query(&self) -> &Query
Returns the selector or query for the fallback/default language (“xx”).
Auto Trait Implementations§
impl !Freeze for Table
impl RefUnwindSafe for Table
impl Send for Table
impl Sync for Table
impl Unpin for Table
impl UnwindSafe for Table
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
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more