# Search

`GET search?q=&lang=&offset=&limit=` searches the published entries with an address that are not `noindex`.

## What it gives

- `total`, `offset`, `limit` and `items`. `limit` is 10 by default, and at most 50. The items come best first. Each item has `title`, `url` (a path), `snippet`, `type`, `date`, `image`, `id`, `module`, `markdown_url` and `relevance`. The `snippet` is plain text with whole words, and `…` where it is cut. The `type` is `page`, `blog` or `record`.
- `facets.module` is `[{value, label, count}]`. It is counted before `module=` filters. `module=blog,page` only keeps those kinds.
- Each item has `score`, `found` and `terms`. `found` are the words that were found, and `terms` is how many words were asked for. `ai=1` adds the `ai_context` of each item. No AI is asked.
- `screens` is given per item, when the page has them. These are the admin screens that a help article is about, such as `["/content/#blog"]`. They come from `admin:` in its front matter, and are kept on import from a zip.

## For one screen of the admin

`screen=/content/#blog` is for the help of Lightbolt itself, for **About this page**. It puts first the pages about exactly that screen and tab. Then it puts the pages about the same screen. Then the rest. Each group keeps its own order. Without `q`, it only gives the pages about that screen. A frontend that searches its own copy does the same, with the `screens` of each entry. Those are in [GET entries](/md/docs/delivery-api/entries/), per language.

## The order

Every site orders results by one score. It is set under **Site settings → Search**, and sent as `settings.search` in [GET site](/md/docs/delivery-api/site/). A frontend that searches its own copy uses the same rules on the same fields. So the order is the same on both sides.

- **The fields** are the title, `ai.context`, the focus words (`seo.keywords`), `seo.description`, and `search.text`. `search.text` is the plain text, sent ready to use.
- **The words** are made without accents (NFKD), and in lowercase. They are words of 2 characters or more, and at most 6 of them. A word counts fully when it is whole. It counts as `prefix` (0.5) when a longer word starts with it, from 3 characters. Words of 2 characters are never needed.
- **The score** uses a weight per field. The text counts less with each extra hit, up to `text_cap`. There is a bonus when the title holds the words in a row, and a factor per kind. Newer items can also count higher.
- **Which first** is `all_first` by default. That puts pages with every needed word first, and then those with some. There are also `all` and `any`.

`settings.search.engine` says who answers. With `score`, you search your own copy. With `elasticsearch`, you ask `GET search` and keep its order. The kind of an item is the module key of a record, `blog`, or `page` for everything else. The exact rules are in FRONTEND.md, under *Search score*, with cases in `lib/data/search-fixtures.json`. With Elasticsearch, the CMS keeps the order of Elasticsearch.

## Good to know

- `items` is empty when the site has search off.
- `GET search` counts nothing. What visitors search for comes from the frontend. That shows under **Insights → What to improve**. The frontend sends its finished searches and clicks in [POST reports](/md/docs/frontend/reports/), as `searches`. These are anonymous counts per term and per day, without an IP, a session or a time.
- A site can have its search answered by Elasticsearch. The answer has the same shape, and also finds typos.
- The public search endpoint for AI agents is on the site itself. See [AI and agents](/md/docs/ai/agents/).

*Also called: search API, full-text search, site search.*

Last changed 26 November 2026
