[][src]Struct meilimelo::Query

pub struct Query<'m> { /* fields omitted */ }

Utility to build a search query

This implements the builder pattern, so you can incrementally build the request you want to perform. The search query can finally be run by using Query::run().

Examples

let meili = MeiliMelo::new("host");

let results = meili.search("employees")
  .query("johnson")
  .facets(FacetBuilder::new("company", "ACME Corp").build())
  .distribution(&["roles"])
  .limit(10)
  .run::<Employee>()
  .await;

Implementations

impl<'m> Query<'m>[src]

pub fn query(self, query: &'m str) -> Query<'_>[src]

MeiliSearch documentation

Arguments

  • query - string of the query to be used

Examples

MeiliMelo::new("host").search("index").query("streamer");

pub fn filters(self, filters: &'m str) -> Query<'_>[src]

MeiliSearch documentation

Arguments

  • filters - string representing to filter to be applied

Examples

MeiliMelo::new("host").search("index").filters("company = ACME AND age > 23");

pub fn limit(self, limit: i64) -> Query<'m>[src]

MeiliSearch documentation

Arguments

  • limit - number of documents to be returned

Examples

MeiliMelo::new("host").search("index").limit(10);

pub fn offset(self, offset: i64) -> Query<'m>[src]

MeiliSearch documentation

Arguments

  • offset - number of documents to skip

Examples

MeiliMelo::new("host").search("index").offset(20);

pub fn facets(self, facets: Facets) -> Query<'m>[src]

MeiliSearch documentation

FacetBuilder must be used to create the facet statement.

Arguments

  • facets - facets to apply to the search

Examples

MeiliMelo::new("host").search("index")
  .facets(FacetBuilder::new("company", "ACME Corp")
  .or("company", "Big Corp")
  .and("roles", "Tech")
  .build());

pub fn retrieve(self, attributes: &'m [&'m str]) -> Query<'m>[src]

MeiliSearch documentation

Arguments

  • attributes - slice of attributes to return

Examples

MeiliMelo::new("host").search("index").retrieve(&["firstname", "lastname"]);

pub fn distribution(self, facets: &'m [&'m str]) -> Query<'m>[src]

MeiliSearch documentation

Arguments

  • attributes - slice of facets for which to return distribution statistics

Examples

MeiliMelo::new("host").search("index").distribution(&["firstname", "lastname"]);

pub fn crop(self, attributes: &'m [Crop<'_>]) -> Query<'m>[src]

MeiliSearch documentation

Arguments

  • attributes - slice of attributes to crop to crop_length or to a specified length

Examples

MeiliMelo::new("host").search("index")
  .crop(&[
     Crop::Attr("overview"),
     Crop::At("description", 10)
   ]);

pub fn crop_length(self, length: i64) -> Query<'m>[src]

MeiliSearch documentation

Arguments

  • attributes - at what length to crop attribute values

Examples

MeiliMelo::new("host").search("index").crop_length(32);

pub fn highlight(self, attributes: &'m [&'m str]) -> Query<'m>[src]

MeiliSearch documentation

Arguments

  • attributes - slice of attributes to highlight

Examples

MeiliMelo::new("host").search("index").highlight(&["overview"]);

pub async fn run<R>(self) -> Result<Results<R>, Error> where
    R: Schema + for<'de> Deserialize<'de>, 
[src]

Trait Implementations

impl<'m> Debug for Query<'m>[src]

impl<'m> Serialize for Query<'m>[src]

Auto Trait Implementations

impl<'m> RefUnwindSafe for Query<'m>

impl<'m> Send for Query<'m>

impl<'m> Sync for Query<'m>

impl<'m> Unpin for Query<'m>

impl<'m> UnwindSafe for Query<'m>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.