CipherStash Documentation


Match supports full text search across one or more string fields in queries.

Supported Types

Index Definition

Match can include strings from multiple fields within the same index. A Match index also requires some configuration and accepts an object with tokenFilters and tokenizer fields.

There are are currently only two token filters available downcase and upcase. These are used to normalise the text before indexing and are also applied to query terms. An empty array can also be passed to tokenFilters if no normalisation of terms is required.

There are two tokenizers provided: standard and ngram. The standard simply splits text into tokens using this regular expression: /[ ,;:!]/. The ngram tokenizer splits the text into n-grams and accepts a configuration object that allows you to specify the tokenLength.

Match indexes can be defined with the "match" kind in a JSON schema definition:

  // (type definition omitted)
  "indexes": {
    "nameAndJobTitle": {
      "kind": "match",
      "fields": ["name", "jobTitle"],
      "tokenFilters": [{ "kind": "downcase" }],
      "tokenizer": { "kind": "ngram", "tokenLength": 3 }

Supported Query Operations

  • match (performs full text search)

StashJS (TypeScript)

let queryResult1 = await employees.all(
  employee => employee.nameAndJobTitle.match("CEO")