Trait SearchIndex

Source
pub trait SearchIndex<P> {
    // Required methods
    fn search(&self, query: &Query) -> Result<HashSet<P>>;
    fn supported_queries(&self) -> SupportedQueries;
}
Expand description

This trait describes the minimum features an Index must support to be usable as a SearchIndex, for example in a SearchEngine.

Required Methods§

Source

fn search(&self, query: &Query) -> Result<HashSet<P>>

Perform a search on an index.

This function returns an HashSet of all matching results. It may not accept all enum values of Query but only a small subset. If a Query is not supported, this function returns UnsupportedQuery.

If the strings in the Query cannot be parsed to the expected payload type, this function returns MismatchedQueryType.

Source

fn supported_queries(&self) -> SupportedQueries

Returns which queries are directly supported by an index.

This function may be used for some features and optimizations by a SearchEngine. For example, it signals which operators (=,>,<,-) in the query parser are supported by an index.

Implementors§

Source§

impl<P, V> SearchIndex<P> for SearchIndexBTreeRange<P, V>
where P: Eq + Hash + Clone + 'static, V: Ord + FromStr + 'static,

Source§

impl<P: Clone, V: Eq + Hash + FromStr> SearchIndex<P> for SearchIndexHashMap<P, V>

Source§

impl<P: Eq + Hash + Clone> SearchIndex<P> for SearchIndexPrefixTree<P>