Struct meilisearch_sdk::documents::DocumentsQuery
source · [−]pub struct DocumentsQuery<'a> {
pub index: &'a Index,
pub offset: Option<usize>,
pub limit: Option<usize>,
pub fields: Option<Vec<&'a str>>,
}Fields
index: &'a Indexoffset: 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.
Implementations
sourceimpl<'a> DocumentsQuery<'a>
impl<'a> DocumentsQuery<'a>
pub fn new(index: &Index) -> DocumentsQuery<'_>
sourcepub fn with_offset(&mut self, offset: usize) -> &mut DocumentsQuery<'a>
pub fn with_offset(&mut self, offset: usize) -> &mut DocumentsQuery<'a>
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>
pub fn with_limit(&mut self, limit: usize) -> &mut DocumentsQuery<'a>
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>
pub fn with_fields(
&mut self,
fields: impl IntoIterator<Item = &'a str>
) -> &mut DocumentsQuery<'a>
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"]);sourcepub async fn execute<T: DeserializeOwned + 'static>(
&self
) -> Result<DocumentsResults<T>, Error>
pub async fn execute<T: DeserializeOwned + 'static>(
&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
sourceimpl<'a> Clone for DocumentsQuery<'a>
impl<'a> Clone for DocumentsQuery<'a>
sourcefn clone(&self) -> DocumentsQuery<'a>
fn clone(&self) -> DocumentsQuery<'a>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
sourceimpl<'a> Debug for DocumentsQuery<'a>
impl<'a> Debug for DocumentsQuery<'a>
sourceimpl<'a> Serialize for DocumentsQuery<'a>
impl<'a> Serialize for DocumentsQuery<'a>
Auto Trait Implementations
impl<'a> RefUnwindSafe for DocumentsQuery<'a>
impl<'a> Send for DocumentsQuery<'a>
impl<'a> Sync for DocumentsQuery<'a>
impl<'a> Unpin for DocumentsQuery<'a>
impl<'a> UnwindSafe for DocumentsQuery<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Instruments this type with the provided Span, returning an
Instrumented wrapper. Read more
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more