-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(spec): add trending models (#213)
- Loading branch information
Showing
16 changed files
with
354 additions
and
110 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
clients/algoliasearch-client-javascript/packages/recommend/model/baseRecommendRequest.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import type { SearchParamsObject } from './searchParamsObject'; | ||
|
||
export type BaseRecommendRequest = { | ||
/** | ||
* The Algolia index name. | ||
*/ | ||
indexName: string; | ||
/** | ||
* The threshold to use when filtering recommendations by their score. | ||
*/ | ||
threshold: number; | ||
/** | ||
* The max number of recommendations to retrieve. If it\'s set to 0, all the recommendations of the objectID may be returned. | ||
*/ | ||
maxRecommendations?: number; | ||
queryParameters?: SearchParamsObject; | ||
fallbackParameters?: SearchParamsObject; | ||
}; |
9 changes: 9 additions & 0 deletions
9
...nts/algoliasearch-client-javascript/packages/recommend/model/baseRecommendationRequest.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import type { RecommendationModels } from './recommendationModels'; | ||
|
||
export type BaseRecommendationRequest = { | ||
model: RecommendationModels; | ||
/** | ||
* Unique identifier of the object. | ||
*/ | ||
objectID: string; | ||
}; |
13 changes: 13 additions & 0 deletions
13
clients/algoliasearch-client-javascript/packages/recommend/model/baseTrendingRequest.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import type { TrendingModels } from './trendingModels'; | ||
|
||
export type BaseTrendingRequest = { | ||
model: TrendingModels; | ||
/** | ||
* The facet name to use for trending models. | ||
*/ | ||
facetName?: string; | ||
/** | ||
* The facet value to use for trending models. | ||
*/ | ||
facetValue?: string; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
clients/algoliasearch-client-javascript/packages/recommend/model/recommendationModels.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/** | ||
* The recommendation model to use. | ||
*/ | ||
|
||
export type RecommendationModels = 'bought-together' | 'related-products'; |
31 changes: 4 additions & 27 deletions
31
clients/algoliasearch-client-javascript/packages/recommend/model/recommendationRequest.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,5 @@ | ||
import type { SearchParams } from './searchParams'; | ||
import type { BaseRecommendRequest } from './baseRecommendRequest'; | ||
import type { BaseRecommendationRequest } from './baseRecommendationRequest'; | ||
|
||
export type RecommendationRequest = { | ||
/** | ||
* The Algolia index name. | ||
*/ | ||
indexName: string; | ||
/** | ||
* Unique identifier of the object. | ||
*/ | ||
objectID: string; | ||
/** | ||
* The recommendation model to use. | ||
*/ | ||
model: RecommendationRequestModel; | ||
/** | ||
* The threshold to use when filtering recommendations by their score. | ||
*/ | ||
threshold: number; | ||
/** | ||
* The max number of recommendations to retrieve. If it\'s set to 0, all the recommendations of the objectID may be returned. | ||
*/ | ||
maxRecommendations?: number; | ||
queryParameters?: SearchParams; | ||
fallbackParameters?: SearchParams; | ||
}; | ||
|
||
export type RecommendationRequestModel = 'bought-together' | 'related-products'; | ||
export type RecommendationRequest = BaseRecommendationRequest & | ||
BaseRecommendRequest; |
4 changes: 4 additions & 0 deletions
4
clients/algoliasearch-client-javascript/packages/recommend/model/recommendationsRequest.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import type { RecommendationRequest } from './recommendationRequest'; | ||
import type { TrendingRequest } from './trendingRequest'; | ||
|
||
export type RecommendationsRequest = RecommendationRequest | TrendingRequest; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
clients/algoliasearch-client-javascript/packages/recommend/model/trendingModels.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/** | ||
* The trending model to use. | ||
*/ | ||
|
||
export type TrendingModels = 'trending-facets' | 'trending-items'; |
4 changes: 4 additions & 0 deletions
4
clients/algoliasearch-client-javascript/packages/recommend/model/trendingRequest.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import type { BaseRecommendRequest } from './baseRecommendRequest'; | ||
import type { BaseTrendingRequest } from './baseTrendingRequest'; | ||
|
||
export type TrendingRequest = BaseRecommendRequest & BaseTrendingRequest; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
recommendationsRequest: | ||
oneOf: | ||
- $ref: '#/trendingRequest' | ||
- $ref: '#/recommendationRequest' | ||
|
||
trendingRequest: | ||
allOf: | ||
- type: object | ||
title: baseTrendingRequest | ||
additionalProperties: false | ||
properties: | ||
model: | ||
$ref: '#/trendingModels' | ||
facetName: | ||
type: string | ||
description: The facet name to use for trending models. | ||
facetValue: | ||
type: string | ||
description: The facet value to use for trending models. | ||
required: | ||
- model | ||
- $ref: '#/baseRecommendRequest' | ||
|
||
recommendationRequest: | ||
allOf: | ||
- type: object | ||
title: baseRecommendationRequest | ||
additionalProperties: false | ||
properties: | ||
model: | ||
$ref: '#/recommendationModels' | ||
objectID: | ||
$ref: '../../../common/parameters.yml#/objectID' | ||
required: | ||
- model | ||
- objectID | ||
- $ref: '#/baseRecommendRequest' | ||
|
||
baseRecommendRequest: | ||
type: object | ||
additionalProperties: false | ||
properties: | ||
indexName: | ||
$ref: '../../../common/parameters.yml#/indexName' | ||
threshold: | ||
type: integer | ||
minimum: 0 | ||
maximum: 100 | ||
description: The threshold to use when filtering recommendations by their score. | ||
maxRecommendations: | ||
type: integer | ||
default: 0 | ||
description: The max number of recommendations to retrieve. If it's set to 0, all the recommendations of the objectID may be returned. | ||
queryParameters: | ||
$ref: '../../../common/schemas/SearchParams.yml#/searchParamsObject' | ||
fallbackParameters: | ||
$ref: '../../../common/schemas/SearchParams.yml#/searchParamsObject' | ||
required: | ||
- indexName | ||
- threshold | ||
|
||
trendingModels: | ||
description: The trending model to use. | ||
type: string | ||
enum: [trending-facets, trending-items] | ||
|
||
recommendationModels: | ||
description: The recommendation model to use. | ||
type: string | ||
enum: [related-products, bought-together] |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.