Search
Search the published content of a site with the FrontStage API, with filters, types, and pages of results
search queries the search index of the site. It uses the same terms, synonyms, boosts, and visibility rules as the search page of a site that Basker renders.
query Search($query: String!, $page: Int) {
search(query: $query, page: $page, limit: 10) {
totalDocs
totalPages
page
hasNextPage
docs {
title
excerpt
collectionType
image { url(transform: { width: 300, format: webp }) alt }
node {
__typename
path
... on Event { startDate }
}
}
}
}With the variables {"query": "beethoven"}, the first result is:
{
"title": "Beethoven Piano Concerto Cycle I",
"excerpt": "Concertos 1 and 2 with our artist in residence.",
"collectionType": "events",
"image": null,
"node": { "__typename": "Event", "path": "/events/beethoven-piano-concerto-cycle-i", "startDate": "2026-11-24T19:30:00.000Z" }
}Arguments
| Argument | Description |
|---|---|
query | The search text. Required. An empty query, or one longer than 256 characters, returns no results. |
filter | A SearchFilter value. Default ALL. |
types | Search only these types: pages, posts, events, people, or series. |
page, limit | Page number and page size. Default 10, maximum 50. |
filter | Returns |
|---|---|
ALL | Every type. |
EVENTS | Events that have not finished. |
PAST_EVENTS | Events that have finished. |
NEWS | Posts. |
PAGES | Pages. |
PEOPLE | People. |
SERIES | Series. |
Results
Each result has title, excerpt, collectionType, and image from the search index. node is the matching record, so you can select any of its fields. Results for records that are not published or not public do not appear.
Use node.path for the link.
Search as you type
Send a request when the visitor stops typing, not on every key press. Each distinct query is a separate URL, so short, common queries come from the edge cache.
let timer: ReturnType<typeof setTimeout> | undefined;
input.addEventListener("input", () => {
clearTimeout(timer);
timer = setTimeout(async () => {
const { search } = await basker.query(SEARCH_QUERY, { query: input.value.trim(), page: 1 });
renderResults(search.docs);
}, 250);
});