Struct jupiter::idb::table::Table

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

source

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.

source

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.

source

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.

source

pub fn table_scan(&self) -> TableIter<'_>

Performs a table scan which simply iterates over all rows of a table.

source

pub fn len(&self) -> usize

Returns the number of rows in the table.

source

pub fn is_empty(&self) -> bool

Determines if this table is empty.

source

pub fn num_queries(&self) -> usize

Returns the number of queries which have been executed against this table.

source

pub fn num_scan_queries(&self) -> usize

Returns the number of queries which have resorted to a table scan in order to execute properly.

source

pub fn num_scans(&self) -> usize

Returns the number of deliberate table scans.

source

pub fn allocated_memory(&self) -> usize

Estimates the allocated memory for both, the table data and its index.

The returned value is in bytes.

source

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where 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> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where 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> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where 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 T
where 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.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more