Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ts): document renderingContent #1273

Merged
merged 2 commits into from Jun 10, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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'];
VladislavFitz marked this conversation as resolved.
Show resolved Hide resolved
};

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;

readonly renderingContent?: Settings['renderingContent'];
Haroenv marked this conversation as resolved.
Show resolved Hide resolved
};
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';
};
};
};
};
};