Struct meilisearch_sdk::documents::DocumentsQuery
source · pub struct DocumentsQuery<'a, Http: HttpClient> {
pub index: &'a Index<Http>,
pub offset: Option<usize>,
pub limit: Option<usize>,
pub fields: Option<Vec<&'a str>>,
pub filter: Option<&'a str>,
}Fields§
§index: &'a Index<Http>§offset: Option<usize>The number of documents to skip.
If the value of the parameter offset is n, the n first documents will not be returned.
This is helpful for pagination.
Example: If you want to skip the first document, set offset to 1.
limit: Option<usize>The maximum number of documents returned.
If the value of the parameter limit is n, there will never be more than n documents in the response.
This is helpful for pagination.
Example: If you don’t want to get more than two documents, set limit to 2.
Default: 20
fields: Option<Vec<&'a str>>The fields that should appear in the documents. By default, all of the fields are present.
filter: Option<&'a str>Filters to apply.
Available since v1.2 of Meilisearch Read the dedicated guide to learn the syntax.
Implementations§
source§impl<'a, Http: HttpClient> DocumentsQuery<'a, Http>
impl<'a, Http: HttpClient> DocumentsQuery<'a, Http>
pub fn new(index: &Index<Http>) -> DocumentsQuery<'_, Http>
sourcepub fn with_offset(&mut self, offset: usize) -> &mut DocumentsQuery<'a, Http>
pub fn with_offset(&mut self, offset: usize) -> &mut DocumentsQuery<'a, Http>
Specify the offset.
§Example
let index = client.index("my_index");
let mut documents_query = DocumentsQuery::new(&index).with_offset(1);sourcepub fn with_limit(&mut self, limit: usize) -> &mut DocumentsQuery<'a, Http>
pub fn with_limit(&mut self, limit: usize) -> &mut DocumentsQuery<'a, Http>
Specify the limit.
§Example
let index = client.index("my_index");
let mut documents_query = DocumentsQuery::new(&index);
documents_query.with_limit(1);sourcepub fn with_fields(
&mut self,
fields: impl IntoIterator<Item = &'a str>,
) -> &mut DocumentsQuery<'a, Http>
pub fn with_fields( &mut self, fields: impl IntoIterator<Item = &'a str>, ) -> &mut DocumentsQuery<'a, Http>
Specify the fields to return in the documents.
§Example
let index = client.index("my_index");
let mut documents_query = DocumentsQuery::new(&index);
documents_query.with_fields(["title"]);pub fn with_filter<'b>( &'b mut self, filter: &'a str, ) -> &'b mut DocumentsQuery<'a, Http>
sourcepub async fn execute<T: DeserializeOwned + 'static + Send + Sync>(
&self,
) -> Result<DocumentsResults<T>, Error>
pub async fn execute<T: DeserializeOwned + 'static + Send + Sync>( &self, ) -> Result<DocumentsResults<T>, Error>
Execute the get documents query.
§Example
#[derive(Debug, Serialize, Deserialize, PartialEq)]
struct MyObject {
id: Option<usize>,
kind: String,
}
let index = client.index("documents_query_execute");
let document = DocumentsQuery::new(&index)
.with_offset(1)
.execute::<MyObject>()
.await
.unwrap();
Trait Implementations§
source§impl<'a, Http: Clone + HttpClient> Clone for DocumentsQuery<'a, Http>
impl<'a, Http: Clone + HttpClient> Clone for DocumentsQuery<'a, Http>
source§fn clone(&self) -> DocumentsQuery<'a, Http>
fn clone(&self) -> DocumentsQuery<'a, Http>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl<'a, Http: Debug + HttpClient> Debug for DocumentsQuery<'a, Http>
impl<'a, Http: Debug + HttpClient> Debug for DocumentsQuery<'a, Http>
source§impl<'a, Http: HttpClient> Serialize for DocumentsQuery<'a, Http>
impl<'a, Http: HttpClient> Serialize for DocumentsQuery<'a, Http>
Auto Trait Implementations§
impl<'a, Http> Freeze for DocumentsQuery<'a, Http>
impl<'a, Http> RefUnwindSafe for DocumentsQuery<'a, Http>where
Http: RefUnwindSafe,
impl<'a, Http> Send for DocumentsQuery<'a, Http>
impl<'a, Http> Sync for DocumentsQuery<'a, Http>
impl<'a, Http> Unpin for DocumentsQuery<'a, Http>
impl<'a, Http> UnwindSafe for DocumentsQuery<'a, Http>where
Http: RefUnwindSafe,
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more