Skip to content
This repository has been archived by the owner on Jul 11, 2023. It is now read-only.

fix(ts): add types for smart sort #809

Merged
merged 4 commits into from Feb 10, 2021
Merged
Changes from 2 commits
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
18 changes: 18 additions & 0 deletions index.d.ts
Expand Up @@ -511,6 +511,16 @@ declare namespace algoliasearchHelper {
ruleContexts?: string[];
optionalFilters?: Array<string | string[]>;
queryLanguages?: string[];

/**
* A number between 0 and 100 indicating
* how strict the hits will be sorted.
* (dynamically at the query time, not in the indexing time)
*
* 0: No smart sort at all, falling back to the original sort.
* 100: Very smart sort, it will provide only relevant hits.
*/
relevancyStrictness?: number;
Copy link
Contributor

@Haroenv Haroenv Feb 9, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this one likely isn't needed (although can be useful for v3 support)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you tell me why it's not needed?
When we need to set relevancyStrictness from the frontend side, we will need it, no?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because the interface inherits from the client type, but in this case we still want to copy it for v3 compact

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah got what you mean 👍🏼

}

export class SearchParameters implements PlainSearchParameters {
Expand Down Expand Up @@ -1156,6 +1166,14 @@ declare namespace algoliasearchHelper {
* total number of hits of this query on the index
*/
nbHits: number;
/**
* total number of hits from smart sort
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we use the same descriptions as in the client? algolia/algoliasearch-client-javascript#1251

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh nice, I didn't know they were already there. 107374a

*/
nbSortedHits?: number;
shortcuts marked this conversation as resolved.
Show resolved Hide resolved
/**
* applied relevancyStrictness either from index setting or search parameters (0~100)
*/
appliedRelevancyStrictness?: number;
/**
* total number of pages with respect to the number of hits per page and the total number of hits
*/
Expand Down