Changelog - 2026-11-03
The search repository counts a query, returns facets alone and suggests, with typed facets and tuning
New Feature Behavior ChangeIn one line. An app with a search box can now count a text search, read facets without hits and autocomplete through the repository, so it no longer needs the raw client for them.
What changed
searchCount({ query, queryBy?, where? }). It counts the documents a text query matches and answers{ count, isFoundExact }.count({ where })still counts by filter only, and is always exact. A text search can stop early, thenisFoundExactisfalseandcountis an estimate.facets({ facetBy, query?, queryBy?, where?, maxFacetValues?, facetQuery? }). It returns{ facets, found, isFoundExact }and no hits. An emptyfacetBy, or amaxFacetValuesthat is not a positive integer, throws before a request.suggest({ query, queryBy?, limit?, includeFields?, where? }). It answers the matching documents for a search box: keyword only, no highlighting, a page of 8 unlesslimitsays otherwise. A blankqueryanswers[]without calling the engine.facetCountshas a real type.ISearchResult.facetCountsisISearchFacetCount[]:fieldName,countsas{ value, count, highlighted? },sampledandstatswhere the engine returns them.highlight: falseon a keyword search. It returns no highlight markup and wins overhighlightFields.- Typed Typesense tuning.
numTypos,dropTokensThreshold,typoTokensThreshold,infix,prioritizeExactMatch,prioritizeTokenPosition,prioritizeNumMatchingFields,textMatchType,rerankHybridMatches,useCacheandcacheTtlare typed byITypesenseTuning, in camelCase, and are read fromengineParamsnext to the wire names that still work. A numeric one that is not a non-negative integer throws before a request. - Hybrid scores on hits. A Typesense hit carries
rankFusionScoreandvectorDistancewhen the engine reports them.scorestays the keywordtext_matchin every mode.
Who is affected
- Apps with a search box. Use the three methods instead of the raw client.
- Code that reads
facetCounts. Its shape changes; see Behavior changes. - Everyone else. No action needed.
Behavior changes
WARNING
facetCounts is no longer the engine's raw JSON. Code that casts it and reads field_name or stats.total_values gets undefined.
On Typesense, each entry used to be the engine's snake_case object. It is now camelCase, and an entry without a field name, or a count without a value and a count, is dropped.
| Before | After | |
|---|---|---|
| Typesense field name | field_name | fieldName |
Typesense value total in stats | stats.total_values | stats.totalValues |
| Meilisearch | facetCounts[0] was the whole facetDistribution record: { genre: { drama: 2 } } | one entry per field: { fieldName: 'genre', counts: [{ value: 'drama', count: 2 }] }, with stats: { min, max } from facetStats |
counts[].value, count and highlighted keep their names. value is always a string.
search(), searchCount(), facets() and suggest() also refuse a field the model hides (hiddenProperties) as facetBy, in facetQuery, as queryBy, as groupBy or in highlightFields / highlightFullFields, with a 400. Before this change search({ facetBy: ['hiddenField'] }) returned its value counts.
Details
const { facets } = await articleRepository.facets({ facetBy: ['category'], where: { published: true } });
const [category] = facets;
category?.counts.map((entry) => `${entry.value} (${entry.count})`);
const { count, isFoundExact } = await articleRepository.searchCount({
query: 'renewable',
queryBy: ['title'],
});
const suggestions = await articleRepository.suggest({
query: 'renew',
queryBy: ['title'],
limit: 5,
includeFields: ['id', 'title'],
});See Search & Typesense for the options, and Search & Meilisearch for what differs there.