File tree Expand file tree Collapse file tree 5 files changed +66
-55
lines changed Expand file tree Collapse file tree 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';
33import {
44 BaseRecommendClient ,
55 RecommendationsQuery ,
6- TrendingQuery ,
6+ TrendingFacetsQuery ,
7+ TrendingItemsQuery ,
8+ TrendingModel ,
79 WithRecommendMethods ,
810} from '../types' ;
911
1012type GetRecommendations = (
1113 base : BaseRecommendClient
1214) => WithRecommendMethods < BaseRecommendClient > [ 'getRecommendations' ] ;
1315
16+ type TrendingQuery =
17+ | ( TrendingItemsQuery & { readonly model : TrendingModel } )
18+ | ( TrendingFacetsQuery & { readonly model : TrendingModel } ) ;
19+
1420export const getRecommendations : GetRecommendations = base => {
1521 return ( queries : ReadonlyArray < RecommendationsQuery | TrendingQuery > , requestOptions ) => {
1622 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 ;
26
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 ' ;
22
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';
1111export * from './RecommendationsQuery' ;
1212export * from './RelatedProductsQuery' ;
1313export * from './TrendingFacetsQuery' ;
14- export * from './TrendingQuery' ;
1514export * from './TrendingItemsQuery' ;
1615export * from './WithRecommendMethods' ;
You can’t perform that action at this time.
0 commit comments