pub struct SearchEngine<'a> { /* private fields */ }Expand description
Content search engine for finding notes.
Implementations§
Source§impl<'a> SearchEngine<'a>
impl<'a> SearchEngine<'a>
Sourcepub async fn text(
&self,
text: &str,
deck: Option<&str>,
) -> Result<Vec<NoteInfo>>
pub async fn text( &self, text: &str, deck: Option<&str>, ) -> Result<Vec<NoteInfo>>
Search for text in any field.
Returns notes containing the exact phrase in any field.
§Arguments
text- Text to search for (exact phrase match)deck- Optional deck to limit search to
§Example
let engine = Engine::new();
// Search all decks
let notes = engine.search().text("example sentence", None).await?;
// Search specific deck
let notes = engine.search().text("verb", Some("Italian")).await?;Sourcepub async fn field(
&self,
field_name: &str,
text: &str,
deck: Option<&str>,
) -> Result<Vec<NoteInfo>>
pub async fn field( &self, field_name: &str, text: &str, deck: Option<&str>, ) -> Result<Vec<NoteInfo>>
Sourcepub async fn regex(
&self,
field_name: &str,
pattern: &str,
deck: Option<&str>,
) -> Result<Vec<NoteInfo>>
pub async fn regex( &self, field_name: &str, pattern: &str, deck: Option<&str>, ) -> Result<Vec<NoteInfo>>
Search with regex in a specific field.
§Arguments
field_name- Name of the field to search inpattern- Regex patterndeck- Optional deck to limit search to
§Example
let engine = Engine::new();
// Find notes where Back field starts with "to "
let notes = engine.search().regex("Back", r"^to\s+", None).await?;Sourcepub async fn wildcard(
&self,
field_name: &str,
pattern: &str,
deck: Option<&str>,
) -> Result<Vec<NoteInfo>>
pub async fn wildcard( &self, field_name: &str, pattern: &str, deck: Option<&str>, ) -> Result<Vec<NoteInfo>>
Search with wildcards in a specific field.
Use * for any sequence of characters, _ for single character.
§Arguments
field_name- Name of the field to search inpattern- Wildcard pattern (e.g.,*tion,h_llo)deck- Optional deck to limit search to
§Example
let engine = Engine::new();
// Find notes ending with "tion"
let notes = engine.search().wildcard("Front", "*tion", None).await?;Sourcepub async fn empty_field(
&self,
field_name: &str,
deck: Option<&str>,
) -> Result<Vec<NoteInfo>>
pub async fn empty_field( &self, field_name: &str, deck: Option<&str>, ) -> Result<Vec<NoteInfo>>
Sourcepub async fn query(&self, query: &str) -> Result<Vec<NoteInfo>>
pub async fn query(&self, query: &str) -> Result<Vec<NoteInfo>>
Search with a custom query built using QueryBuilder.
This allows combining the content search with full QueryBuilder capabilities.
§Example
use ankit::QueryBuilder;
let engine = Engine::new();
let query = QueryBuilder::new()
.deck("Japanese")
.is_due()
.not_suspended()
.lapses_gte(3)
.build();
let notes = engine.search().query(&query).await?;Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for SearchEngine<'a>
impl<'a> !RefUnwindSafe for SearchEngine<'a>
impl<'a> Send for SearchEngine<'a>
impl<'a> Sync for SearchEngine<'a>
impl<'a> Unpin for SearchEngine<'a>
impl<'a> !UnwindSafe for SearchEngine<'a>
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