Skip to main content

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

NameTypeFormatDescription
tabsobject[]TabAn array of tabs
facetsobject{ [key]: Facet }An object with a key for each facet that is required for the search
listingsobject{ [key]: Facet }An object with a key for each independent listing that is required for the site
minilistobject{ [key]: Facet }An object with a key for each independently identifiable minilist that is required for the site

Tab

NameTypeFormatDescription
idnumberThe zero-based incrementing id assigned to the tab
labelstringThe tab's label for rendering
defaultFacetstringThe initially displayed facet (if not the first specified)
totalCountstring[]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

NameTypeFormatDescription
[key]stringkey-safe-no-spacesThe facet key used to identify the facet
isDefaultbooloptionalThe first facet to be shown if no facet is supplied via a route parameter
isDisabledbooloptionalSet to true to temporarily disable the facet
tabIdnumberUse 0 for default or the id assigned to the tab
title
projectIdstringoptionalUse this to target the search to a project other than the default configured
queryParamsobjectQueryParamsQuery params object to drive the search for this facet
filtersobject{ [key]: Filter }An object with a key for each filter that is required in this facet

QueryParams

NameTypeFormatDescription
contentTypeIdsstring[]An array of contentTypeIds to search over (sys.dataFormat == 'entry'); Prefix an entry with a "!" to exclude that content type from the search
assetTypesstring[]optionalAn array of assetTypes to search over (sys.dataFormat == 'asset'); Prefix an entry with a "!" to exclude that content type from the search
webpageTemplatesstring[]optionalAn array of webpageTemplates to search over (sys.dataFormat == 'webpage'); Prefix an entry with a "!" to exclude that webpage template from the search
fieldsstring[]An array of fields to return for each entry in the items[]
linkDepthnumberoptionalThe linkDepth to apply to the facet search (defaults to 0)
featuredResultsobjectFeaturedResultsAn object containing the configuration to drive fetching featured search results separately from the main search results
includeInSearchstring[]optionalAn 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
loadMorePagingbooleanoptionalInclude 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
orderBystring[]An array of orderBy expressions to add to the search query
pageSizenumberThe number of items returned per page in the search
useSearchTermbooleanoptionalAllow a configured minilist to read the search.term set in state (default is false) works with minilists only
weightedSearchFieldsobject[]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)
customWhereobject[]CustomWhereClause[]An array of CustomWhereClause to include in the search query

FeaturedResults

NameTypeFormatDescription
fieldIdstring / string[]optionalThe 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.
fieldValueanyoptionalThe value for the field used to distinguish featured results from regular search results
contentTypeIdstring / string[]optionalInstead of using a field to distinguish featured results, you can get results from a special content type containing featured search results in entry data.
countnumberThe number of featured results to return (and exclude from the main search results)

WeightedSearchField

NameTypeFormatDescription
fieldIdstring / 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.
weightnumberThe 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.

NameTypeFormatDescription
fieldstringThe field to query
[operator]anyThe value to evaluate with the chosen operator

Filter

NameTypeFormatDescription
[key]stringkey-safe-no-spacesThe filter key used to identify the filter, and in any route parameters or query string
titlestringThe title to render next to the filter
contentTypeIdstringoptionalThe content type id to dynamically load entries from and load into state under the items[]
fieldIdstring / string[]optionalThe 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.
fieldOperatorstringoptionalThe Delivery API operator used when applying the selected filter
itemsobject[]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 }]
logicOperatorstringoptionalThe Delivery API logical operator used when applying the selected filter, e.g. 'and', 'or' - default is 'or'.
renderablebooloptionalSet to false to exclude this filter from the filter prop
customWhereobject[]optional CustomWhereClauseAn array of CustomWhereClause to include in the search query when dynamically loading entries via the contentTypeId key

FilterItem

NameTypeFormatDescription
keystringThis will usually be the entry id or the taxonomy key
titlestringThe title to render next to the filter item
pathstringoptionalThis will usually be the entry slug or the taxonomy path
isSelectedbooloptionalWhether 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:

PropertyTypeDefaultNotes
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.
fuzzySearchbooleanfalseEnable fuzzy matching on free-text queries. Useful for typo tolerance.
versionStatus'latest' \| 'published'env defaultOverride the version filter per facet. Use 'latest' on staging, 'published' on production.
languagesstring[]Restrict results to these language codes. E.g. ['en-GB'].
omitDefaultSearchFieldsstring[]Remove specific fields from the default weighted search set.
internalPagingbooleanfalseFetch 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

ModeConfigBehavior
DefaultReplace results on each page navigation
Load moreloadMorePaging: trueAppend results; all loaded pages accumulated in paging.pagesLoaded
InternalinternalPaging: trueFetch all at once; paginate entirely in-browser

Annotated example

A complete search.config.ts showing facets, listings, and a minilist:

src/app/search/search.config.ts
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.