[−][src]Struct meilimelo::Query
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]
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]
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]
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]
Arguments
offset
- number of documents to skip
Examples
MeiliMelo::new("host").search("index").offset(20);
pub fn facets(self, facets: Facets) -> Query<'m>
[src]
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]
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]
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]
Arguments
attributes
- slice of attributes to crop tocrop_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]
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]
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]
R: Schema + for<'de> Deserialize<'de>,
Trait Implementations
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,