OpenFolia

Search modules, manuals and terms

GET
/search

Modules by title, keywords, FAQ questions and text, manuals by title, and terms (one result per term and language) by their preferred variant (as the title), their allowed and forbidden variants (as keywords) and their definition (as text), among what the reader may see, at ?ref=. Case and diacritics do not matter, and every word of the query is found anywhere in a title, in the keywords, in one FAQ question or in one block. With the Postgres search (the default) a word is found in any of its forms in the content’s language too (starting finds starts), and with a typo in a title or keyword; with an embedder configured, by meaning too (meta.matchedOn: meaning, after every word match). Title matches come first, then keyword matches, FAQ question matches (meta.matchedOn: question) and text matches, each ranked by how well they match in all of those ways. The filters run before paging, and the total counts only results the reader may see. A module filter (type, audience, facet, keyword) leaves manuals and terms out; with one, filter[q] may be left out, and every module the filters let through is a result (meta.matchedOn: filter), ordered by title. A filter value the configuration does not know matches nothing (no error). The excerpt is plain text with the match offsets in meta. Limits: each reader (a person or a service account) may search CCMS_SEARCH_PER_MINUTE times a minute on a server (default 120; past it 429 rate-limited), and a search has CCMS_SEARCH_TIMEOUT_MS in the database for all its statements together (default 5 s; past it 503 database-timeout); both answers carry Retry-After.

Authorization

bearer
headerAuthorizationBearer <JWT>

A service account's token (ccms_sat_…, issued by POST /service-accounts/{id}/tokens), or, for local use and demo mode, the server's shared CCMS_API_TOKEN.

Query Parameters

filter[q]?string

What to search for, 1 to 200 characters after trimming. Every word has to match, in the title, in the keywords or in one block's text; case and diacritics do not matter. Required unless a module filter (filter[type] as a module type, filter[audience], filter[facet], filter[keyword]) is given.

Length1 <= length <= 200
filter[lang]?string

Only modules and terms in this language (manuals have none, so they are left out).

Match^[a-zA-Z]{2,3}(?:-[A-Za-z0-9]{2,8})*$
filter[resourceType]?string

Only Module, only Manual or only Term results (as in attributes.resourceType; module, manual and term too).

Value in"module""manual""term""Module""Manual""Term"
filter[type]?string

Only modules of this module type (a configured key, e.g. procedure); manuals are left out. Deprecated meaning: without filter[resourceType], the values module and manual still mean filter[resourceType], as they did before it; use filter[resourceType] for that.

Match^[a-z][a-z0-9-]*$
Lengthlength <= 64
filter[audience]?string

Only modules that count as this audience level: their own, or the last, most restricted level for a module naming none, as manuals and the access check place it. A level the configuration does not list matches nothing, and a module naming such a level matches no level.

Match^[a-z][a-z0-9-]*$
Lengthlength <= 64
filter[facet]?|array<string>

Only modules with this facet value, as <facet>:<value> (e.g. region:north). Repeat it for several, at most 32: a module has to have every one.

filter[keyword]?|array<string>

Only modules with this keyword, case and diacritics aside (Wärme is warme); 1 to 64 characters, no comma. Repeat it for several, at most 32: a module has to have every one.

page[number]?integer

Page to return, from 1. Default: 1.

Range1 <= value
page[size]?integer

Resources per page. Default: 50, at most 200.

Range1 <= value <= 200
ref?string

Branch, tag or commit ID to read from. Default: the server's CCMS_DEFAULT_REF.

Response Body

application/vnd.api+json
  1. response
data*array<>
meta*
links*
Example Request
curl -X GET 'http://localhost:3000/search'
Example Response
{  "data": [    {      "type": "SearchResult",      "id": "string",      "attributes": {        "resourceType": "Module",        "resourceId": "string",        "lang": "string",        "title": "string",        "blockId": "string"      },      "relationships": {        "resource": {          "data": {            "type": "Module",            "id": "string"          }        }      },      "meta": {        "matchedOn": "title",        "excerpt": "string",        "matches": [          {            "start": 0,            "end": 0          }        ],        "deprecated": true      }    }  ],  "meta": {    "page": {      "currentPage": -9007199254740991,      "lastPage": -9007199254740991,      "perPage": -9007199254740991,      "total": -9007199254740991    }  },  "links": {    "self": "string",    "first": "string",    "last": "string",    "prev": "string",    "next": "string"  }}