Algoliax (Algoliax v0.11.0)
View SourceAlgoliax is wrapper for Algolia api
Configuration
Algoliax needs :api_key, :application_id and an :http_client config. The
:api_key and :application_id can either be set in config files or via the
environment variables "ALGOLIA_API_KEY" and "ALGOLIA_APPLICATION_ID". The
:http_client is a module implementing the Algoliax.HttpClient behaviour —
Algoliax ships none of its own (see Algoliax.HttpClient).
config :algoliax,
api_key: "",
application_id: "",
http_client: MyApp.AlgoliaHttpClient
Summary
Functions
Generate a secured api key with filter
Same as generate_secured_api_key/2 but returns the key or raises if invalid params
Wait for a task to be published on Algolia side. Work with all indexer function except reindex_atomic/0
Forward user ip to algolia operations
Functions
@spec generate_secured_api_key(api_key :: String.t(), params :: map()) :: {:ok, binary()} | {:error, binary()}
Generate a secured api key with filter
Examples
Algoliax.generate_secured_api_key("api_key", %{filters: "reference:10"})
Algoliax.generate_secured_api_key("api_key", %{filters: "reference:10 OR nickname:john"})
Same as generate_secured_api_key/2 but returns the key or raises if invalid params
Examples
Algoliax.generate_secured_api_key!("api_key", %{filters: "reference:10"})
Algoliax.generate_secured_api_key!("api_key", %{filters: "reference:10 OR nickname:john"})
Wait for a task to be published on Algolia side. Work with all indexer function except reindex_atomic/0
Examples
MyApp.People.save_object(%MyApp.People{id: 1}) |> Algoliax.wait_task()
Forward user ip to algolia operations
Algoliax.with_user_ip("192.168.0.1", fn ->
MyIndexer.search("test")
end)