Skip to content

Commit

Permalink
feat(ts): add virtual index parameters (#1251)
Browse files Browse the repository at this point in the history
* feat(ts): add virtual index parameters

fixes #1249

* Update packages/client-search/src/types/Settings.ts

* Apply suggestions from code review

Co-authored-by: Antoine Hémery <[email protected]>

* Update packages/client-search/src/types/SearchResponse.ts

Co-authored-by: Antoine Hémery <[email protected]>
  • Loading branch information
Haroenv and Ant-hem authored Feb 8, 2021
1 parent 5032d6f commit cffd8f0
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/client-search/src/types/SearchOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -342,4 +342,11 @@ export type SearchOptions = {
* results.
*/
readonly decompoundQuery?: boolean;

/**
* The relevancy threshold to apply to search in a virtual index [0-100]. A Bigger
* value means fewer, but more relevant results, smaller value means more, but
* less relevant results.
*/
readonly relevancyStrictness?: number;
};
10 changes: 10 additions & 0 deletions packages/client-search/src/types/SearchResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ export type SearchResponse<TObject = {}> = {
*/
nbHits: number;

/**
* Subset of hits selected when relevancyStrictness is applied.
*/
nbSortedHits?: number;

/**
* Number of pages returned.
*
Expand Down Expand Up @@ -215,4 +220,9 @@ export type SearchResponse<TObject = {}> = {
*/
params?: Record<string, any>;
};

/**
* The relevancy threshold applied to search in a virtual index.
*/
appliedRelevancyStrictness?: number;
};
7 changes: 7 additions & 0 deletions packages/client-search/src/types/Settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -297,4 +297,11 @@ export type Settings = {
* transliteration to make words indexed in Katakana or Kanji searchable in Hiragana.
*/
readonly attributesToTransliterate?: readonly string[];

/**
* The relevancy threshold to apply to search in a virtual index [0-100]. A Bigger
* value means fewer, but more relevant results, smaller value means more, but
* less relevant results.
*/
readonly relevancyStrictness?: number;
};

0 comments on commit cffd8f0

Please sign in to comment.