Meilisearch.Search (meilisearch v0.20.0) View Source
Collection of functions used to search for documents matching given query.
Link to this section Summary
Functions
Search for documents matching a specific query in the given index.
Link to this section Functions
Specs
search(String.t(), String.t() | nil, Keyword.t()) :: Meilisearch.HTTP.response()
Search for documents matching a specific query in the given index.
A search_query
value of nil
will send a placeholder query.
Options
offset
Number of documents to skip. Defaults to0
limit
Maximum number of documents returned. Defaults to20
Examples
iex> Meilisearch.Search.search("meilisearch_test", "where art thou")
{:ok,
%{
"exhaustiveNbHits" => false,
"hits" => [
%{
"id" => 2,
"tagline" => "They have a plan but not a clue",
"title" => "O' Brother Where Art Thou"
}
],
"limit" => 20,
"nbHits" => 1,
"offset" => 0,
"processingTimeMs" => 17,
"query" => "where art thou"
}}
iex> Meilisearch.Search.search("meilisearch_test", "nothing will match")
{:ok,
%{
"exhaustiveNbHits" => false,
"hits" => [],
"limit" => 20,
"nbHits" => 0,
"offset" => 0,
"processingTimeMs" => 27,
"query" => "nothing will match"
}}