pub struct SimpleSearchEngine { /* private fields */ }Expand description
Simple search engine for WASM.
Implementations§
Source§impl SimpleSearchEngine
impl SimpleSearchEngine
Sourcepub async fn load(index_url: &str) -> Result<SimpleSearchEngine, JsValue>
pub async fn load(index_url: &str) -> Result<SimpleSearchEngine, JsValue>
Load a simple search index from a URL.
Sourcepub fn from_json(json: &str) -> Result<SimpleSearchEngine, JsValue>
pub fn from_json(json: &str) -> Result<SimpleSearchEngine, JsValue>
Create from a JSON string (for testing).
Sourcepub fn search(
&self,
query: &str,
limit: Option<usize>,
) -> Result<JsValue, JsValue>
pub fn search( &self, query: &str, limit: Option<usize>, ) -> Result<JsValue, JsValue>
Search the index.
Sourcepub fn document_count(&self) -> usize
pub fn document_count(&self) -> usize
Get the number of indexed documents.
Sourcepub fn term_count(&self) -> usize
pub fn term_count(&self) -> usize
Get the number of indexed terms.
Trait Implementations§
Source§impl From<SimpleSearchEngine> for JsValue
impl From<SimpleSearchEngine> for JsValue
Source§fn from(value: SimpleSearchEngine) -> Self
fn from(value: SimpleSearchEngine) -> Self
Converts to this type from the input type.
Source§impl FromWasmAbi for SimpleSearchEngine
impl FromWasmAbi for SimpleSearchEngine
Source§impl IntoWasmAbi for SimpleSearchEngine
impl IntoWasmAbi for SimpleSearchEngine
Source§impl RefFromWasmAbi for SimpleSearchEngine
impl RefFromWasmAbi for SimpleSearchEngine
Source§type Anchor = RcRef<SimpleSearchEngine>
type Anchor = RcRef<SimpleSearchEngine>
The type that holds the reference to
Self for the duration of the
invocation of the function that has an &Self parameter. This is
required to ensure that the lifetimes don’t persist beyond one function
call, and so that they remain anonymous.Source§impl TryFromJsValue for SimpleSearchEngine
impl TryFromJsValue for SimpleSearchEngine
Source§impl VectorFromWasmAbi for SimpleSearchEngine
impl VectorFromWasmAbi for SimpleSearchEngine
type Abi = <Box<[JsValue]> as FromWasmAbi>::Abi
unsafe fn vector_from_abi(js: Self::Abi) -> Box<[SimpleSearchEngine]>
Source§impl VectorIntoWasmAbi for SimpleSearchEngine
impl VectorIntoWasmAbi for SimpleSearchEngine
type Abi = <Box<[JsValue]> as IntoWasmAbi>::Abi
fn vector_into_abi(vector: Box<[SimpleSearchEngine]>) -> Self::Abi
Source§impl WasmDescribeVector for SimpleSearchEngine
impl WasmDescribeVector for SimpleSearchEngine
impl SupportsConstructor for SimpleSearchEngine
impl SupportsInstanceProperty for SimpleSearchEngine
impl SupportsStaticProperty for SimpleSearchEngine
Auto Trait Implementations§
impl Freeze for SimpleSearchEngine
impl RefUnwindSafe for SimpleSearchEngine
impl Send for SimpleSearchEngine
impl Sync for SimpleSearchEngine
impl Unpin for SimpleSearchEngine
impl UnwindSafe for SimpleSearchEngine
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
Mutably borrows from an owned value. Read more
Source§impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
Source§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
Same as
IntoWasmAbi::AbiSource§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
Same as
IntoWasmAbi::into_abi, except that it may throw and never
return in the case of Err.