Struct meilisearch_sdk::documents::DocumentQuery
source · [−]Fields
index: &'a Indexfields: Option<Vec<&'a str>>The fields that should appear in the documents. By default all of the fields are present.
Implementations
sourceimpl<'a> DocumentQuery<'a>
impl<'a> DocumentQuery<'a>
pub fn new(index: &Index) -> DocumentQuery<'_>
sourcepub fn with_fields(
&mut self,
fields: impl IntoIterator<Item = &'a str>
) -> &mut DocumentQuery<'a>
pub fn with_fields(
&mut self,
fields: impl IntoIterator<Item = &'a str>
) -> &mut DocumentQuery<'a>
Specify the fields to return in the document.
Example
let index = client.index("document_query_with_fields");
let mut document_query = DocumentQuery::new(&index);
document_query.with_fields(["title"]);sourcepub async fn execute<T: DeserializeOwned + 'static>(
&self,
document_id: &str
) -> Result<T, Error>
pub async fn execute<T: DeserializeOwned + 'static>(
&self,
document_id: &str
) -> Result<T, Error>
Execute the get document query.
Example
#[derive(Debug, Serialize, Deserialize, PartialEq)]
struct MyObject {
id: String,
kind: String,
}
#[derive(Debug, Serialize, Deserialize, PartialEq)]
struct MyObjectReduced {
id: String,
}
let document = DocumentQuery::new(&index).with_fields(["id"]).execute::<MyObjectReduced>("1").await.unwrap();
assert_eq!(
document,
MyObjectReduced { id: "1".to_string() }
);Trait Implementations
sourceimpl<'a> Clone for DocumentQuery<'a>
impl<'a> Clone for DocumentQuery<'a>
sourcefn clone(&self) -> DocumentQuery<'a>
fn clone(&self) -> DocumentQuery<'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 DocumentQuery<'a>
impl<'a> Debug for DocumentQuery<'a>
sourceimpl<'a> Serialize for DocumentQuery<'a>
impl<'a> Serialize for DocumentQuery<'a>
Auto Trait Implementations
impl<'a> RefUnwindSafe for DocumentQuery<'a>
impl<'a> Send for DocumentQuery<'a>
impl<'a> Sync for DocumentQuery<'a>
impl<'a> Unpin for DocumentQuery<'a>
impl<'a> UnwindSafe for DocumentQuery<'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