Skip to content

Commit

Permalink
feat(ts): document renderingContent (#1273)
Browse files Browse the repository at this point in the history
* feat(ts): document renderingContent

DX-2066

see also the helper PR: algolia/algoliasearch-helper-js#823

* Update packages/client-search/src/types/SearchResponse.ts
  • Loading branch information
Haroenv committed Jun 10, 2021
1 parent fec87a9 commit 04f2a20
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 4 deletions.
12 changes: 9 additions & 3 deletions packages/client-search/src/types/Rule.ts
@@ -1,4 +1,4 @@
import { SearchOptions } from '.';
import { SearchOptions, Settings } from '.';

export type Rule = {
/**
Expand Down Expand Up @@ -125,6 +125,12 @@ export type ConsequenceParams = {
* Behaves like optionalFilters.
*/
readonly automaticOptionalFacetFilters?: readonly AutomaticFacetFilter[];

/**
* Content defining how the search interface should be rendered.
* A default value for this can be set via settings
*/
readonly renderingContent?: Settings['renderingContent'];
};

export type Condition = {
Expand Down Expand Up @@ -186,12 +192,12 @@ export type Consequence = {

export type TimeRange = {
/**
* DateTime with UTC offset for Serialization/Deserialization in unix timespam.
* DateTime with UTC offset for Serialization/Deserialization in unix timespan.
*/
readonly from: number;

/**
* DateTime with UTC offset for Serialization/Deserialization in unix timespam.
* DateTime with UTC offset for Serialization/Deserialization in unix timespan.
*/
readonly until: number;
};
4 changes: 3 additions & 1 deletion packages/client-search/src/types/SearchResponse.ts
@@ -1,4 +1,4 @@
import { Hit } from '.';
import { Hit, Settings } from '.';

export type SearchResponse<TObject = {}> = {
/**
Expand Down Expand Up @@ -225,4 +225,6 @@ export type SearchResponse<TObject = {}> = {
* The relevancy threshold applied to search in a virtual index.
*/
appliedRelevancyStrictness?: number;

renderingContent?: Settings['renderingContent'];
};
39 changes: 39 additions & 0 deletions packages/client-search/src/types/Settings.ts
Expand Up @@ -304,4 +304,43 @@ export type Settings = {
* less relevant results.
*/
readonly relevancyStrictness?: number;

/**
* Content defining how the search interface should be rendered.
* This is set via the settings for a default value and can be overridden via rules
*/
readonly renderingContent?: {
/**
* defining how facets should be ordered
*/
readonly facetOrdering?: {
/**
* the ordering of facets (widgets)
*/
readonly facet?: {
/**
* pinned order of facet lists
*/
readonly order: readonly string[];
};
/**
* the ordering of facet values, within an individual list
*/
readonly values?: {
readonly [facet: string]: {
/**
* pinned order of facet values
*/
readonly order: readonly string[];
/**
* How to display the remaining items.
* - facet count (descending)
* - alphabetical (ascending)
* - hidden (show only pinned values)
*/
readonly sortRemainingBy: 'count' | 'alpha' | 'hidden';
};
};
};
};
};

0 comments on commit 04f2a20

Please sign in to comment.