Skip to main content

Searcher

Trait Searcher 

Source
pub trait Searcher {
    // Required method
    fn search(
        &self,
        query: &str,
        options: SearchOptions,
    ) -> ThingdResult<Vec<SearchHit>>;
}
Expand description

Search operations.

§Examples

use thingd::{MemoryEngine, ObjectStore, Searcher, MemoryObject, SearchOptions};

let mut store = MemoryEngine::new();
store.put_object(MemoryObject::new("docs", "readme", "Getting started guide")).unwrap();

let results = store.search("getting started", SearchOptions::default()).unwrap();
assert!(!results.is_empty());

Required Methods§

Source

fn search( &self, query: &str, options: SearchOptions, ) -> ThingdResult<Vec<SearchHit>>

Search memory objects and event logs by query text.

§Errors

Returns an error when search query fails.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl Searcher for MemoryEngine

Source§

impl Searcher for SqliteThingStore

Available on crate feature sqlite only.