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§
Sourcefn search(&self, query: &Query) -> Result<HashSet<P>>
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.
Sourcefn supported_queries(&self) -> SupportedQueries
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.