File tree 5 files changed +66
-55
lines changed
5 files changed +66
-55
lines changed Original file line number Diff line number Diff line change @@ -3,14 +3,20 @@ import { MethodEnum } from '@algolia/requester-common';
3
3
import {
4
4
BaseRecommendClient ,
5
5
RecommendationsQuery ,
6
- TrendingQuery ,
6
+ TrendingFacetsQuery ,
7
+ TrendingItemsQuery ,
8
+ TrendingModel ,
7
9
WithRecommendMethods ,
8
10
} from '../types' ;
9
11
10
12
type GetRecommendations = (
11
13
base : BaseRecommendClient
12
14
) => WithRecommendMethods < BaseRecommendClient > [ 'getRecommendations' ] ;
13
15
16
+ type TrendingQuery =
17
+ | ( TrendingItemsQuery & { readonly model : TrendingModel } )
18
+ | ( TrendingFacetsQuery & { readonly model : TrendingModel } ) ;
19
+
14
20
export const getRecommendations : GetRecommendations = base => {
15
21
return ( queries : ReadonlyArray < RecommendationsQuery | TrendingQuery > , requestOptions ) => {
16
22
const requests : ReadonlyArray < RecommendationsQuery | TrendingQuery > = queries . map ( query => ( {
Original file line number Diff line number Diff line change 1
- import { TrendingQuery } from './TrendingQuery' ;
1
+ export type TrendingFacetsQuery = {
2
+ /**
3
+ * The name of the target index.
4
+ */
5
+ readonly indexName : string ;
2
6
3
- export type TrendingFacetsQuery = Omit <
4
- TrendingQuery ,
5
- 'model' | 'facetValue' | 'fallbackParameters' | 'queryParameters'
6
- > ;
7
+ /**
8
+ * Threshold for the recommendations confidence score (between 0 and 100). Only recommendations with a greater score are returned.
9
+ */
10
+ readonly threshold ?: number ;
11
+
12
+ /**
13
+ * How many recommendations to retrieve.
14
+ */
15
+ readonly maxRecommendations ?: number ;
16
+
17
+ /**
18
+ * The facet attribute to get recommendations for.
19
+ */
20
+ readonly facetName : string ;
21
+ } ;
Original file line number Diff line number Diff line change 1
- import { TrendingQuery } from './TrendingQuery ' ;
1
+ import { RecommendSearchOptions } from '@algolia/recommend ' ;
2
2
3
- export type TrendingItemsQuery = Omit < TrendingQuery , 'model' > ;
3
+ export type TrendingItemsQuery = {
4
+ /**
5
+ * The name of the target index.
6
+ */
7
+ readonly indexName : string ;
8
+
9
+ /**
10
+ * Threshold for the recommendations confidence score (between 0 and 100). Only recommendations with a greater score are returned.
11
+ */
12
+ readonly threshold ?: number ;
13
+
14
+ /**
15
+ * How many recommendations to retrieve.
16
+ */
17
+ readonly maxRecommendations ?: number ;
18
+
19
+ /**
20
+ * List of [search parameters](https://www.algolia.com/doc/api-reference/search-api-parameters/) to send.
21
+ */
22
+ readonly queryParameters ?: RecommendSearchOptions ;
23
+
24
+ /**
25
+ * List of [search parameters](https://www.algolia.com/doc/api-reference/search-api-parameters/) to send.
26
+ *
27
+ * Additional filters to use as fallback when there aren’t enough recommendations.
28
+ */
29
+ readonly fallbackParameters ?: RecommendSearchOptions ;
30
+
31
+ /**
32
+ * The facet attribute to get recommendations for.
33
+ */
34
+ readonly facetName ?: string ;
35
+
36
+ /**
37
+ * The value of the target facet.
38
+ */
39
+ readonly facetValue ?: string ;
40
+ } ;
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -11,6 +11,5 @@ export * from './RecommendSearchOptions';
11
11
export * from './RecommendationsQuery' ;
12
12
export * from './RelatedProductsQuery' ;
13
13
export * from './TrendingFacetsQuery' ;
14
- export * from './TrendingQuery' ;
15
14
export * from './TrendingItemsQuery' ;
16
15
export * from './WithRecommendMethods' ;
You can’t perform that action at this time.
0 commit comments