Magnolia

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}/queryquery, filters, facets, facetFilters, numericFilters, tagFilters, page, hitsPerPage, attributesToRetrieve, attributesToHighlight, attributesToSnippet, getRankingInfo, distinct, typoTolerance, restrictSearchableAttributes, removeWordsIfNoResults, clickAnalytics.
POST /magnolia/1/indexes/*/queriesrequests: several searches. This is what InstantSearch sends.
POST /magnolia/1/indexes/{index}/batchrequests: 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}/partialChanges part of a record.
POST /magnolia/1/indexes/*/objectsrequests: several records by ID.
POST /magnolia/1/indexes/{index}/browseEvery record, with a cursor.
POST /magnolia/1/indexes/{index}/clearEmpties it.
DELETE /magnolia/1/indexes/{index}Deletes it.
POST /magnolia/1/indexes/{index}/operationoperation (copy or move), destination. How an atomic reindex is done.
GET, PUT /magnolia/1/indexes/{index}/settingssearchableAttributes, attributesForFaceting, customRanking, ranking, replicas, attributeForDistinct, distinct, removeWordsIfNoResults and more.
POST /magnolia/1/indexes/{index}/synonyms/batchAlso /search and /clear.
POST /magnolia/1/indexes/{index}/rules/batchAlso /search and /clear. Pins, hides, filters, query changes and userData.
GET /magnolia/1/indexesYour indexes.
POST /magnolia/1/eventsClicks 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 /indexesYour indexes, with searches and speed.
POST /index/{name}/searchA search with the reason for each result.
POST /index/{name}/uploadA JSON, NDJSON or CSV file as the body.
POST /index/{name}/pinquery, object_id, position, undo.
POST /index/{name}/hidequery, object_id, undo.
GET /index/{name}/testsWhat searches should find, and whether they do.
POST /index/{name}/testsquery, expect, within.
GET /index/{name}/analyticsTop searches, searches that found nothing, and speed.
POST /import/algoliaapp_id, admin_key. Admins only.