Skip to content

POST request support for search method#33

Open
hatched-VitaliyYatsunyk wants to merge 2 commits into
sikanhe:masterfrom
hatched-VitaliyYatsunyk:post-support
Open

POST request support for search method#33
hatched-VitaliyYatsunyk wants to merge 2 commits into
sikanhe:masterfrom
hatched-VitaliyYatsunyk:post-support

Conversation

@hatched-VitaliyYatsunyk

Copy link
Copy Markdown

Currently search Algolia method assumes and supports only GET requests to Algolia REST API.
We faced a problem when sending very long lists of arguments (filters, facetFilters, etc) because of the max request URL length.

In order to resolve this I added support for POST request type which can be specified as follows:

# assuming options variable can have some other arguments, like paging for example

option = options |> Enum.concat([request_method: :post])
...
case Algolia.search(index_name, query, options) do
    {:ok, results} ->
        ...
    {:error, _, message}   ->
        {:error, message}
    {:error, message}      ->
        {:error, message}
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants