Algoliax (Algoliax v0.10.0)
View SourceAlgoliax is wrapper for Algolia api
Configuration
Algoliax needs only :api_key
and application_id
config. These configs can either be on config files or using environment varialble "ALGOLIA_API_KEY"
and "ALGOLIA_APPLICATION_ID"
.
config :algoliax,
api_key: "",
application_id: ""
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)