Config
src/app/search/search.config.ts defines all facets, listings, and minilists. Each entry declares what to search for, which fields to return, and how results should be filtered and sorted.
Keys must always be defined as constants in src/app/schema/search.schema.ts before being referenced here — never use string literals directly.
Search config
| Name | Type | Format | Description |
|---|---|---|---|
| tabs | object[] | Tab | An array of tabs |
| facets | object | { [key]: Facet } | An object with a key for each facet that is required for the search |
| listings | object | { [key]: Facet } | An object with a key for each independent listing that is required for the site |
| minilist | object | { [key]: Facet } | An object with a key for each independently identifiable minilist that is required for the site |
Tab
| Name | Type | Format | Description |
|---|---|---|---|
| id | number | The zero-based incrementing id assigned to the tab | |
| label | string | The tab's label for rendering | |
| defaultFacet | string | The initially displayed facet (if not the first specified) | |
| totalCount | string[] | Facet[key][] | The facets which make up the tab's total results (useful if you do not want a mixed-results facet to interfere with the total, or if you only want to count the mixed-results facet results and not facets which are a filtered set of another facet's results) |
Facet
| Name | Type | Format | Description |
|---|---|---|---|
| [key] | string | key-safe-no-spaces | The facet key used to identify the facet |
| isDefault | bool | optional | The first facet to be shown if no facet is supplied via a route parameter |
| isDisabled | bool | optional | Set to true to temporarily disable the facet |
| tabId | number | Use 0 for default or the id assigned to the tab | |
| title | |||
| projectId | string | optional | Use this to target the search to a project other than the default configured |
| queryParams | object | QueryParams | Query params object to drive the search for this facet |
| filters | object | { [key]: Filter } | An object with a key for each filter that is required in this facet |
QueryParams
| Name | Type | Format | Description |
|---|---|---|---|
| contentTypeIds | string[] | An array of contentTypeIds to search over (sys.dataFormat == 'entry'); Prefix an entry with a "!" to exclude that content type from the search | |
| assetTypes | string[] | optional | An array of assetTypes to search over (sys.dataFormat == 'asset'); Prefix an entry with a "!" to exclude that content type from the search |
| webpageTemplates | string[] | optional | An array of webpageTemplates to search over (sys.dataFormat == 'webpage'); Prefix an entry with a "!" to exclude that webpage template from the search |
| fields | string[] | An array of fields to return for each entry in the items[] | |
| linkDepth | number | optional | The linkDepth to apply to the facet search (defaults to 0) |
| featuredResults | object | FeaturedResults | An object containing the configuration to drive fetching featured search results separately from the main search results |
| includeInSearch | string[] | optional | An array of field ids relating to boolean field types in the destination content types to control whether or not the entry can be shown in search results |
| loadMorePaging | boolean | optional | Include this parameter to change the pagination behavior of your search. Load more paging will retain previously fetched search results, appending additional pages of results to the existing results array, rather than replacing the results[] when switching pages normally |
| orderBy | string[] | An array of orderBy expressions to add to the search query | |
| pageSize | number | The number of items returned per page in the search | |
| useSearchTerm | boolean | optional | Allow a configured minilist to read the search.term set in state (default is false) works with minilists only |
| weightedSearchFields | object[] | WeightedSearchField[] | An array of WeightedSearchField to include in the search query. If you do not include this configuration, your search term will be queries against a default set of fields that exist in every content type. It is recommended to specify weightedSearchFields for each contentTypeId specified in your queryParams so you can search for terms that exist within custom entry fields and weight the results returned from each field according to their relevance. The default fields include entryTitle, entryDescription, keywords, sys.uri and searchContent (available in Contensis v14+ only) |
| customWhere | object[] | CustomWhereClause[] | An array of CustomWhereClause to include in the search query |
FeaturedResults
| Name | Type | Format | Description |
|---|---|---|---|
| fieldId | string / string[] | optional | The field used to distinguish featured results from regular search results. An array of fieldIds can be provided to wrap multiple field expressions inside an or operator. |
| fieldValue | any | optional | The value for the field used to distinguish featured results from regular search results |
| contentTypeId | string / string[] | optional | Instead of using a field to distinguish featured results, you can get results from a special content type containing featured search results in entry data. |
| count | number | The number of featured results to return (and exclude from the main search results) |
WeightedSearchField
| Name | Type | Format | Description |
|---|---|---|---|
| fieldId | string / string[] | The field to apply the weighted search term to. An array of fieldIds can be provided to wrap the weighted search expression inside an or operator. | |
| weight | number | The weight value to supply to the Delivery API to rank the search results |
CustomWhereClause
N.B. This shares syntax with adding where operators to a search query when using the Delivery API via HTTP, and should be used sparingly for exceptional cases where the standard query falls short. Clauses can also be wrapped in not, and, and or expressions.
| Name | Type | Format | Description |
|---|---|---|---|
| field | string | The field to query | |
| [operator] | any | The value to evaluate with the chosen operator |
Filter
| Name | Type | Format | Description |
|---|---|---|---|
| [key] | string | key-safe-no-spaces | The filter key used to identify the filter, and in any route parameters or query string |
| title | string | The title to render next to the filter | |
| contentTypeId | string | optional | The content type id to dynamically load entries from and load into state under the items[] |
| fieldId | string / string[] | optional | The content type field(s) to apply the filter key to, to filter the list of returned results. Use 'sys.contentTypeId' to filter results by a specific content type id defined as a FilterItem[].key. Supply an array of fieldIds to filter results by any provided values in multiple fields for a given filter key. |
| fieldOperator | string | optional | The Delivery API operator used when applying the selected filter |
| items | object[] | FilterItem[] | Supply an empty array or a hardcoded list of FilterItem depending on the type of filter required. To filter by a list of content types, supply an array of FilterItem[{ key, title }] |
| logicOperator | string | optional | The Delivery API logical operator used when applying the selected filter, e.g. 'and', 'or' - default is 'or'. |
| renderable | bool | optional | Set to false to exclude this filter from the filter prop |
| customWhere | object[] | optional CustomWhereClause | An array of CustomWhereClause to include in the search query when dynamically loading entries via the contentTypeId key |
FilterItem
| Name | Type | Format | Description |
|---|---|---|---|
| key | string | This will usually be the entry id or the taxonomy key | |
| title | string | The title to render next to the filter item | |
| path | string | optional | This will usually be the entry slug or the taxonomy path |
| isSelected | bool | optional | Whether the filter is in a selected state |
Additional QueryParams fields
The following fields are available on queryParams in addition to those in the table above:
| Property | Type | Default | Notes |
|---|---|---|---|
fieldLinkDepths | { [field: string]: number } | — | Resolve links only on named fields. Preferred over raising global linkDepth. Must be used instead of linkDepth when the baseline is already 2 or higher. |
fuzzySearch | boolean | false | Enable fuzzy matching on free-text queries. Useful for typo tolerance. |
versionStatus | 'latest' \| 'published' | env default | Override the version filter per facet. Use 'latest' on staging, 'published' on production. |
languages | string[] | — | Restrict results to these language codes. E.g. ['en-GB']. |
omitDefaultSearchFields | string[] | — | Remove specific fields from the default weighted search set. |
internalPaging | boolean | false | Fetch all results at once and paginate entirely in the browser. |
fieldLinkDepths vs linkDepth
Prefer fieldLinkDepths over raising the global linkDepth. It resolves linked entries only on the specific fields your mapper needs, avoiding over-fetching:
// ✅ Preferred — resolve only what the mapper uses
queryParams: {
fields: [...baseFields, 'author', 'category'],
linkDepth: 0,
fieldLinkDepths: {
author: 1, // resolve the linked author entry
category: 1, // resolve the linked category entry
},
}
// ⚠️ Acceptable when no linked fields already exist at depth ≥ 2
queryParams: {
fields: [...baseFields, 'author'],
linkDepth: 1,
}
// ❌ Avoid when linkDepth is already 2+ — use fieldLinkDepths instead
queryParams: {
linkDepth: 3, // resolves ALL linked fields 3 levels deep — expensive
}
Pagination modes
| Mode | Config | Behavior |
|---|---|---|
| Default | — | Replace results on each page navigation |
| Load more | loadMorePaging: true | Append results; all loaded pages accumulated in paging.pagesLoaded |
| Internal | internalPaging: true | Fetch all at once; paginate entirely in-browser |
Annotated example
A complete search.config.ts showing facets, listings, and a minilist:
import type { SearchConfig, WeightedSearchField } from '@zengenti/contensis-react-base/search';
import type { WhereClause } from '@zengenti/contensis-react-base/models/search/models/Search';
import { contentTypes } from '~/schema/contentTypes.schema';
import { baseFields } from '~/schema/fields.schema';
import { facets, listings, minilists, freeTextWeights } from '~/schema/search.schema';
const whereSysUri: WhereClause = { field: 'sys.uri', exists: true };
export const searchConfig = {
facets: {
[facets.all]: {
title: 'Site Search',
queryParams: {
contentTypeIds: [
contentTypes.blogPost,
contentTypes.plant,
],
fields: [...baseFields],
linkDepth: 0,
pageSize: 10,
weightedSearchFields: [
{ fieldId: 'entryTitle', weight: freeTextWeights.title },
{ fieldId: 'entryDescription', weight: freeTextWeights.description },
] as WeightedSearchField[],
customWhere: [whereSysUri],
fuzzySearch: false,
orderBy: ['-sys.version.published'],
},
},
},
listings: {
[listings.plants]: {
title: 'Plants',
queryParams: {
contentTypeIds: [contentTypes.plant],
fields: [...baseFields, 'category'],
fieldLinkDepths: { category: 1 },
pageSize: 12,
customWhere: [whereSysUri],
loadMorePaging: true,
orderBy: ['fields.entryTitle'],
},
filters: {
category: {
title: 'Category',
fieldId: 'category.sys.id', // linked entry — always use .sys.id
fieldOperator: 'equalTo',
isSingleSelect: false,
contentTypeId: contentTypes.category,
items: [], // CRB populates at runtime
},
},
},
},
minilist: {
[minilists.relatedArticles]: {
title: 'Related Articles',
queryParams: {
contentTypeIds: [contentTypes.blogPost],
fields: [...baseFields],
pageSize: 4,
customWhere: [whereSysUri],
},
},
},
} as SearchConfig;
For the customWhere operator syntax and SearchFilter type reference, see the Filters guide.