View Source Meilisearch.Search (meilisearch_ex v1.1.2)
Search into your Meilisearch indexes. Search API
Link to this section Summary
Functions
Search into your Meilisearch indexes using a POST request. Meilisearch documentation
Link to this section Types
@type search_params() :: %{ q: String.t(), offset: integer(), limit: integer(), hitsPerPage: integer(), page: integer(), filter: String.t() | [String.t()] | nil, facets: [String.t()] | nil, attributesToRetrieve: [String.t()], attributesToCrop: [String.t()] | nil, cropLength: integer(), cropMarker: String.t(), attributesToHighlight: [String.t()] | nil, highlightPreTag: String.t(), highlightPostTag: String.t(), showMatchesPosition: boolean(), sort: [String.t()] | nil, matchingStrategy: String.t() | :last | :all }
Link to this section Functions
@spec search( Tesla.Client.t(), String.t(), q: String.t(), offset: integer(), limit: integer(), hitsPerPage: integer(), page: integer(), filter: String.t() | [String.t()] | nil, facets: [String.t()] | nil, attributesToRetrieve: [String.t()], attributesToCrop: [String.t()] | nil, cropLength: integer(), cropMarker: String.t(), attributesToHighlight: [String.t()] | nil, highlightPreTag: String.t(), highlightPostTag: String.t(), showMatchesPosition: boolean(), sort: [String.t()] | nil, matchingStrategy: String.t() | :last | :all ) :: {:ok, t(Meilisearch.Document.t())} | {:error, Meilisearch.Client.error()}
Search into your Meilisearch indexes using a POST request. Meilisearch documentation
examples
Examples
iex> client = Meilisearch.Client.new(endpoint: "http://localhost:7700", key: "master_key_test")
iex> Meilisearch.Search.search(client, "movies", q: "space")
{:ok, %{
offset: 0,
limit: 20,
estimatedTotalHits: 1,
totalHits: 1,
totalPages: 1,
totalPages: 1,
page: 1,
facetDistribution: %{
"genres" => %{
"action" => 273,
"animation" => 118,
"adventure" => 132,
"fantasy" => 67,
"comedy" => 475,
"mystery" => 70,
"thriller" => 217
}
},
processingTimeMs: 11,
query: "space",
hits: [%{
"id" => 2001,
"title" => "2001: A Space Odyssey"
}]
}}