algolia v0.8.0 Algolia
Elixir implementation of Algolia search API, using Hackney for http requests
Link to this section Summary
Functions
Add an Object
Add multiple objects
Clears all content of an index
Copies an index to a new one
Remove all objects matching a filter (including geo filters)
Deletes the index
Delete a object by its objectID
Delete multiple objects
Get the logs of the latest search and indexing operations
Get an object in an index by objectID
Get the settings of a index
List all indexes
Moves an index to new one
Multiple queries
Partially updates an object, takes option upsert: true or false
Partially updates multiple objects
Save a single object, without objectID specified, must have objectID as a field
Save multiple objects
Search a single index
Search for facet values
Set the settings of a index
Convinient version of wait_task/4, accepts a response to be waited on directly. This enables piping a operation directly into wait_task
Wait for a task for an index to complete returns :ok when it’s done
Link to this section Functions
Add an Object
An attribute can be chosen as the objectID.
Add multiple objects
An attribute can be chosen as the objectID.
Clears all content of an index
Copies an index to a new one
Remove all objects matching a filter (including geo filters).
Allowed filter parameters:
filters
facetFilters
numericFilters
aroundLatLng
andaroundRadius
(these two need to be used together)insideBoundingBox
insidePolygon
Examples
iex> Algolia.delete_by("index", filters: ["score < 30"])
{:ok, %{"indexName" => "index", "taskId" => 42, "deletedAt" => "2018-10-30T15:33:13.556Z"}}
Deletes the index
Delete a object by its objectID
Delete multiple objects
Get the logs of the latest search and indexing operations.
Options
:indexName
- Index for which log entries should be retrieved. When omitted, log entries are retrieved across all indices.:length
- Maximum number of entries to retrieve. Maximum allowed value: 1000.:offset
- First entry to retrieve (zero-based). Log entries are sorted by decreasing date, therefore 0 designates the most recent log entry.:type
- Type of log to retrieve:all
(default),query
,build
orerror
.
Get an object in an index by objectID
Get the settings of a index
List all indexes
Moves an index to new one
Multiple queries
Partially updates an object, takes option upsert: true or false
Partially updates multiple objects
Save a single object, without objectID specified, must have objectID as a field
Save multiple objects
Search a single index
Search for facet values
Enables you to search through the values of a facet attribute, selecting only a subset of those values that meet a given criteria.
For a facet attribute to be searchable, it must have been declared in the
attributesForFaceting
index setting with the searchable
modifier.
Facet-searching only affects facet values. It does not impact the underlying index search.
The results are sorted by decreasing count. This can be adjusted via
sortFacetValuesBy
.
By default, maximum 10 results are returned. This can be adjusted via
maxFacetHits
.
Examples
iex> Algolia.search_for_facet_values("species", "phylum", "dophyta")
{
:ok,
%{
"exhaustiveFacetsCount" => false,
"faceHits" => [
%{
"count" => 9000,
"highlighted" => "Pteri<em>dophyta</em>",
"value" => "Pteridophyta"
},
%{
"count" => 7000,
"highlighted" => "Rho<em>dophyta</em>",
"value" => "Rhodophyta"
},
%{
"count" => 150,
"highlighted" => "Cyca<em>dophyta</em>",
"value" => "Cycadophyta"
}
],
"processingTimeMS" => 42
}
}
Set the settings of a index
Convinient version of wait_task/4, accepts a response to be waited on directly. This enables piping a operation directly into wait_task
Wait for a task for an index to complete returns :ok when it’s done