[][src]Struct meilisearch_sdk::search::Query

pub struct Query<'a> {
    pub query: &'a str,
    pub offset: Option<usize>,
    pub limit: Option<usize>,
    pub filters: Option<&'a str>,
    pub facet_filters: Option<Vec<Vec<&'a str>>>,
    pub facets_distribution: Option<Option<Vec<&'a str>>>,
    pub attributes_to_retrieve: Option<&'a str>,
    pub attributes_to_crop: Option<&'a str>,
    pub crop_length: Option<usize>,
    pub attributes_to_highlight: Option<&'a str>,
}

A struct representing a query. You can add search parameters using the builder syntax. See here for the list and description of all parameters.

Example

let query = Query::new("space")
    .with_offset(42)
    .with_limit(21);

Fields

query: &'a str

The query parameter is the only mandatory parameter. This is the string used by the search engine to find relevant documents.

offset: Option<usize>

A number of documents to skip. If the value of the parameter offset is n, n first documents to skip. This is helpful for pagination.

Example: If you want to skip the first document, set offset to 1. Default: 0

limit: Option<usize>

Set a limit to the number of documents returned by search queries. If the value of the parameter limit is n, there will be n documents in the search query response. This is helpful for pagination.

Example: If you want to get only two documents, set limit to 2. Default: 20

filters: Option<&'a str>

Specify a filter to be used with the query. See the dedicated guide.

facet_filters: Option<Vec<Vec<&'a str>>>

Facet names and values to filter on. See this page.

facets_distribution: Option<Option<Vec<&'a str>>>

Facets for which to retrieve the matching count. The value Some(None) is the wildcard.

attributes_to_retrieve: Option<&'a str>

Attributes to display in the returned documents. Comma-separated list of attributes whose fields will be present in the returned documents.

Example: If you want to get only the overview and title field and not the other fields, set attributes_to_retrieve to overview,title. Default: The displayed attributes list which contains by default all attributes found in the documents.

attributes_to_crop: Option<&'a str>

TODO doc

crop_length: Option<usize>

Number of characters to keep on each side of the start of the matching word. See attributes_to_crop.

Default: 200

attributes_to_highlight: Option<&'a str>

TODO doc

Implementations

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

pub fn new(query: &'a str) -> Query<'a>[src]

pub fn with_offset(self, offset: usize) -> Query<'a>[src]

pub fn with_limit(self, limit: usize) -> Query<'a>[src]

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

pub fn with_facet_filters(self, facet_filters: Vec<Vec<&'a str>>) -> Query<'a>[src]

pub fn with_facets_distribution(
    self,
    facets_distribution: Option<Vec<&'a str>>
) -> Query<'a>
[src]

pub fn with_attributes_to_retrieve(
    self,
    attributes_to_retrieve: &'a str
) -> Query<'a>
[src]

pub fn with_attributes_to_crop(self, attributes_to_crop: &'a str) -> Query<'a>[src]

pub fn with_attributes_to_highlight(
    self,
    attributes_to_highlight: &'a str
) -> Query<'a>
[src]

pub fn with_crop_length(self, crop_length: usize) -> Query<'a>[src]

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

pub async fn execute<T: 'static + DeserializeOwned, '_>(
    &'a self,
    index: &'_ Index<'a>
) -> Result<SearchResults<T>, Error>
[src]

Alias for the Index method.

Auto Trait Implementations

impl<'a> RefUnwindSafe for Query<'a>

impl<'a> Send for Query<'a>

impl<'a> Sync for Query<'a>

impl<'a> Unpin for Query<'a>

impl<'a> UnwindSafe for Query<'a>

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, 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.