API
Searching and indexing
The same as Algolia's REST API, so their libraries work. Send your Application ID and key as X-Algolia-Application-Id and X-Algolia-API-Key. A search key can only search, and secured keys signed from it work as they do on Algolia. Writes are done by the time they return, so waiting on a task returns straight away.
import { algoliasearch } from "algoliasearch";
const client = algoliasearch("APP_ID", "SEARCH_KEY", {
hosts: [{ url: "harrowsoft.com/magnolia", accept: "readWrite", protocol: "https" }],
});
// On version 4 of their client, leave out accept.
| POST /magnolia/1/indexes/{index}/query | query, filters, facets, facetFilters, numericFilters, tagFilters, page, hitsPerPage, attributesToRetrieve, attributesToHighlight, attributesToSnippet, getRankingInfo, distinct, typoTolerance, restrictSearchableAttributes, removeWordsIfNoResults, clickAnalytics. |
| POST /magnolia/1/indexes/*/queries | requests: several searches. This is what InstantSearch sends. |
| POST /magnolia/1/indexes/{index}/batch | requests: addObject, updateObject, partialUpdateObject, partialUpdateObjectNoCreate, deleteObject, clear. Use * with indexName for several indexes. |
| POST /magnolia/1/indexes/{index} | Adds a record. |
| PUT, GET, DELETE /magnolia/1/indexes/{index}/{objectID} | One record. |
| POST /magnolia/1/indexes/{index}/{objectID}/partial | Changes part of a record. |
| POST /magnolia/1/indexes/*/objects | requests: several records by ID. |
| POST /magnolia/1/indexes/{index}/browse | Every record, with a cursor. |
| POST /magnolia/1/indexes/{index}/clear | Empties it. |
| DELETE /magnolia/1/indexes/{index} | Deletes it. |
| POST /magnolia/1/indexes/{index}/operation | operation (copy or move), destination. How an atomic reindex is done. |
| GET, PUT /magnolia/1/indexes/{index}/settings | searchableAttributes, attributesForFaceting, customRanking, ranking, replicas, attributeForDistinct, distinct, removeWordsIfNoResults and more. |
| POST /magnolia/1/indexes/{index}/synonyms/batch | Also /search and /clear. |
| POST /magnolia/1/indexes/{index}/rules/batch | Also /search and /clear. Pins, hides, filters, query changes and userData. |
| GET /magnolia/1/indexes | Your indexes. |
| POST /magnolia/1/events | Clicks and conversions, with the queryID from a search with clickAnalytics. |
Managing it from a script
Make a token on your tokens page, and send it as Authorization: Bearer hs_.... It can do what you can, no more.
| GET /indexes | Your indexes, with searches and speed. |
| POST /index/{name}/search | A search with the reason for each result. |
| POST /index/{name}/upload | A JSON, NDJSON or CSV file as the body. |
| POST /index/{name}/pin | query, object_id, position, undo. |
| POST /index/{name}/hide | query, object_id, undo. |
| GET /index/{name}/tests | What searches should find, and whether they do. |
| POST /index/{name}/tests | query, expect, within. |
| GET /index/{name}/analytics | Top searches, searches that found nothing, and speed. |
| POST /import/algolia | app_id, admin_key. Admins only. |