SHADE is young: 0.1.0-next.2 is a pre-release, and 0.1.0 isn't out yet.

SHADE
Content

Search

SHADE searches the text of entries in its own database: in the admin's lists, and for a site through the content API. It understands word endings ("fiets" finds "fietsen"), ranks the best matches first and works in every site language. No other service is needed.

What users can do

Editors and admins

  • Type in the Search… box of a collection's list. It looks in every field that holds text, including fields in groups and repeaters, rich text and the site's other languages, and puts the best match first (pick a sort to order the list yourself instead).
  • Drafts are found too: the search follows the latest saved version of every entry, and only the collections the signed-in person may read.
  • A change shows up in search within seconds, not at once. A new entry or a published change is picked up by a background job.

Admins

  • Rebuild the search index under Settings, Search index builds the index of every collection again from its entries, for when search misses entries (after restoring a database, for instance). The card shows "Rebuilding…" with how many entries it indexed, and says when it is done; search keeps answering meanwhile. It is in the audit log (search.rebuild). The card shows while Search is switched on.

Sites and apps

  • Ask GET /api/v1/content/search?q=… with a read token, or shade.search('fietsen') in the TypeScript client. It finds published entries of collections with a public API, matched in their public fields only. A draft, a hidden field and a collection without a public API are never found or shown.
  • A result has the collection, the entry's id, its slug and title, and a few highlights: the field's text around the match as plain text, with the matched ranges. The site marks them itself.

Module authors

  • A field can set its weight in ranking: search: 'A' to 'D', or search: false to leave it out.
  • A module that keeps a json field says what text it holds with searchText in its manifest (Content).

How it behaves

  • Words and the start of the last word. The search matches whole words after their endings are removed, in the language of the search, and the last word you typed as its beginning, so a list finds "About" at "abo". It does not find the middle of words or typos.
  • Quotes, or and -. "rode appel" is a phrase, appel or peer either word, appel -peer leaves out entries with "peer". Any other text is safe to search for.
  • Weights. A match in the title counts most, then short text and slugs, then longer text and rich text. Fields such as email addresses, links, numbers, dates and references are not searched, unless a collection gives them a weight. On a tie the newer entry comes first.
  • Order. Results come best match first, among the 2,000 newest matches: on a very large site an older entry that matches better can fall behind them. One word being typed, such as "fie", lists the newest matches first, since they all match about as well.
  • Accents. "cafe" finds "café", where the database has the unaccent extension (SHADE asks for it when it creates the search tables). Without it, search works and accents count.
  • Languages. The language of the search picks how words are shortened: Dutch, English, German, French and the other languages the database knows. A language without one is searched word for word. A language an entry has no translation in is searched in the default language's text, as the site shows it.
  • Limits. A search takes up to 200 characters, gives at most 50 results per page and reaches the first 500. The content API's search is rate limited per token, a collection list's search included, and stops a search that takes more than 3 seconds.
  • Switch. An admin can switch Search off under Settings, Modules. The search route stops and lists search with a plain text filter; the index stays up to date and is ready when it is switched on again.
  • Privacy. The index is a copy that follows the entry: an unpublished, changed or deleted entry leaves it, and nothing is kept that the entry no longer holds. A collection's index is built again from its entries when its fields or the site's languages change, and for every collection when an admin rebuilds it.
  • Static sites. SHADE's own site, built with Astro, keeps searching with a static index made at build time, in the visitor's browser (the site). The API's search is for everything else: a site that renders on the server, an app, or collections that have no page.