Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

POST request support for search method #33

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

hatched-VitaliyYatsunyk

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