-
Notifications
You must be signed in to change notification settings - Fork 26
feat(spec): add trending models #213
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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: | ||
shortcuts marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.