@algolia/recommend 5.2.5 → 5.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.d.ts +520 -406
- package/dist/builds/browser.js +42 -32
- package/dist/builds/browser.js.map +1 -1
- package/dist/builds/browser.min.js +1 -1
- package/dist/builds/browser.min.js.map +1 -1
- package/dist/builds/browser.umd.js +1 -1
- package/dist/builds/node.cjs +42 -32
- package/dist/builds/node.cjs.map +1 -1
- package/dist/builds/node.js +42 -32
- package/dist/builds/node.js.map +1 -1
- package/dist/node.d.cts +520 -406
- package/dist/node.d.ts +520 -406
- package/dist/src/recommendClient.cjs +42 -32
- package/dist/src/recommendClient.cjs.map +1 -1
- package/dist/src/recommendClient.js +42 -32
- package/dist/src/recommendClient.js.map +1 -1
- package/package.json +4 -4
package/dist/node.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import * as _algolia_client_common from '@algolia/client-common';
|
|
2
|
-
import { ClientOptions } from '@algolia/client-common';
|
|
2
|
+
import { CreateClientOptions, RequestOptions, ClientOptions } from '@algolia/client-common';
|
|
3
3
|
|
|
4
|
-
type
|
|
5
|
-
|
|
6
|
-
type AlternativesAsExact = 'ignorePlurals' | 'multiWordsSynonym' | 'singleWordSynonym';
|
|
4
|
+
type RecommendModels = 'bought-together' | 'related-products' | 'trending-facets' | 'trending-items';
|
|
7
5
|
|
|
8
6
|
/**
|
|
9
7
|
* Range object with lower and upper values in meters to define custom ranges.
|
|
@@ -34,20 +32,6 @@ type AroundRadiusAll = 'all';
|
|
|
34
32
|
*/
|
|
35
33
|
type AroundRadius = AroundRadiusAll | number;
|
|
36
34
|
|
|
37
|
-
/**
|
|
38
|
-
* Facet attribute. Only recommendations with the same value (or only recommendations with a different value) as the original viewed item are included.
|
|
39
|
-
*/
|
|
40
|
-
type AutoFacetFilter = {
|
|
41
|
-
/**
|
|
42
|
-
* Facet attribute.
|
|
43
|
-
*/
|
|
44
|
-
facet?: string;
|
|
45
|
-
/**
|
|
46
|
-
* Whether the filter is negative. If true, recommendations must not have the same value for the `facet` attribute. If false, recommendations must have the same value for the `facet` attribute.
|
|
47
|
-
*/
|
|
48
|
-
negative?: boolean;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
35
|
/**
|
|
52
36
|
* Filter the search by facet values, so that only records with the same facet values are retrieved. **Prefer using the `filters` parameter, which supports all filter types and combinations with boolean operators.** - `[filter1, filter2]` is interpreted as `filter1 AND filter2`. - `[[filter1, filter2], filter3]` is interpreted as `filter1 OR filter2 AND filter3`. - `facet:-value` is interpreted as `NOT facet:value`. While it\'s best to avoid attributes that start with a `-`, you can still filter them by escaping with a backslash: `facet:\\-value`.
|
|
53
37
|
*/
|
|
@@ -191,6 +175,10 @@ type SearchParamsQuery = {
|
|
|
191
175
|
|
|
192
176
|
type BaseSearchParams = BaseSearchParamsWithoutQuery & SearchParamsQuery;
|
|
193
177
|
|
|
178
|
+
type AdvancedSyntaxFeatures = 'exactPhrase' | 'excludeWords';
|
|
179
|
+
|
|
180
|
+
type AlternativesAsExact = 'ignorePlurals' | 'multiWordsSynonym' | 'singleWordSynonym';
|
|
181
|
+
|
|
194
182
|
/**
|
|
195
183
|
* Determines how many records of a group are included in the search results. Records with the same value for the `attributeForDistinct` attribute are considered a group. The `distinct` setting controls how many members of the group are returned. This is useful for [deduplication and grouping](https://www.algolia.com/doc/guides/managing-results/refine-results/grouping/#introducing-algolias-distinct-feature). The `distinct` setting is ignored if `attributeForDistinct` is not set.
|
|
196
184
|
*/
|
|
@@ -476,258 +464,272 @@ type BaseRecommendRequest = {
|
|
|
476
464
|
};
|
|
477
465
|
|
|
478
466
|
/**
|
|
479
|
-
*
|
|
467
|
+
* Frequently bought together model. This model recommends items that have been purchased within 1 day with the item with the ID `objectID`.
|
|
480
468
|
*/
|
|
481
|
-
type
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
facetsCount?: boolean;
|
|
486
|
-
/**
|
|
487
|
-
* The value is `false` if not all facet values are retrieved.
|
|
488
|
-
*/
|
|
489
|
-
facetValues?: boolean;
|
|
490
|
-
/**
|
|
491
|
-
* Whether the `nbHits` is exhaustive (`true`) or approximate (`false`). When the query takes more than 50ms to be processed, the engine makes an approximation. This can happen when using complex filters on millions of records, when typo-tolerance was not exhaustive, or when enough hits have been retrieved (for example, after the engine finds 10,000 exact matches). `nbHits` is reported as non-exhaustive whenever an approximation is made, even if the approximation didn’t, in the end, impact the exhaustivity of the query.
|
|
492
|
-
*/
|
|
493
|
-
nbHits?: boolean;
|
|
494
|
-
/**
|
|
495
|
-
* Rules matching exhaustivity. The value is `false` if rules were enable for this query, and could not be fully processed due a timeout. This is generally caused by the number of alternatives (such as typos) which is too large.
|
|
496
|
-
*/
|
|
497
|
-
rulesMatch?: boolean;
|
|
469
|
+
type FbtModel = 'bought-together';
|
|
470
|
+
|
|
471
|
+
type FrequentlyBoughtTogether = {
|
|
472
|
+
model: FbtModel;
|
|
498
473
|
/**
|
|
499
|
-
*
|
|
474
|
+
* Unique record identifier.
|
|
500
475
|
*/
|
|
501
|
-
|
|
476
|
+
objectID: string;
|
|
502
477
|
};
|
|
503
478
|
|
|
504
|
-
type
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
*/
|
|
516
|
-
avg?: number;
|
|
479
|
+
type BoughtTogetherQuery = BaseRecommendRequest & FrequentlyBoughtTogether;
|
|
480
|
+
|
|
481
|
+
type FallbackParams = Record<string, unknown> & SearchParamsObject;
|
|
482
|
+
|
|
483
|
+
/**
|
|
484
|
+
* Looking similar model. This model recommends items that look similar to the item with the ID `objectID` based on image attributes in your index.
|
|
485
|
+
*/
|
|
486
|
+
type LookingSimilarModel = 'looking-similar';
|
|
487
|
+
|
|
488
|
+
type LookingSimilar = {
|
|
489
|
+
model: LookingSimilarModel;
|
|
517
490
|
/**
|
|
518
|
-
*
|
|
491
|
+
* Unique record identifier.
|
|
519
492
|
*/
|
|
520
|
-
|
|
493
|
+
objectID: string;
|
|
494
|
+
fallbackParameters?: FallbackParams;
|
|
521
495
|
};
|
|
522
496
|
|
|
497
|
+
type LookingSimilarQuery = BaseRecommendRequest & LookingSimilar;
|
|
498
|
+
|
|
523
499
|
/**
|
|
524
|
-
*
|
|
500
|
+
* \"Recommened for you\" model.
|
|
525
501
|
*/
|
|
526
|
-
type
|
|
527
|
-
|
|
502
|
+
type RecommendedForYouModel = 'recommended-for-you';
|
|
503
|
+
|
|
504
|
+
type RecommendedForYou = {
|
|
505
|
+
model: RecommendedForYouModel;
|
|
506
|
+
fallbackParameters?: FallbackParams;
|
|
528
507
|
};
|
|
529
508
|
|
|
530
|
-
type
|
|
509
|
+
type RecommendedForYouQuery = BaseRecommendRequest & RecommendedForYou;
|
|
510
|
+
|
|
511
|
+
/**
|
|
512
|
+
* Related products or similar content model. This model recommends items that are similar to the item with the ID `objectID`. Similarity is determined from the user interactions and attributes.
|
|
513
|
+
*/
|
|
514
|
+
type RelatedModel = 'related-products';
|
|
515
|
+
|
|
516
|
+
type RelatedProducts = {
|
|
517
|
+
model: RelatedModel;
|
|
531
518
|
/**
|
|
532
|
-
*
|
|
519
|
+
* Unique record identifier.
|
|
533
520
|
*/
|
|
534
|
-
|
|
521
|
+
objectID: string;
|
|
522
|
+
fallbackParameters?: FallbackParams;
|
|
523
|
+
};
|
|
524
|
+
|
|
525
|
+
type RelatedQuery = BaseRecommendRequest & RelatedProducts;
|
|
526
|
+
|
|
527
|
+
/**
|
|
528
|
+
* Trending facet values model. This model recommends trending facet values for the specified facet attribute.
|
|
529
|
+
*/
|
|
530
|
+
type TrendingFacetsModel = 'trending-facets';
|
|
531
|
+
|
|
532
|
+
type TrendingFacets = {
|
|
535
533
|
/**
|
|
536
|
-
*
|
|
534
|
+
* Facet attribute for which to retrieve trending facet values.
|
|
537
535
|
*/
|
|
538
|
-
|
|
536
|
+
facetName: any | null;
|
|
537
|
+
model: TrendingFacetsModel;
|
|
538
|
+
fallbackParameters?: FallbackParams;
|
|
539
|
+
};
|
|
540
|
+
|
|
541
|
+
type TrendingFacetsQuery = BaseRecommendRequest & TrendingFacets;
|
|
542
|
+
|
|
543
|
+
/**
|
|
544
|
+
* Trending items model. Trending items are determined from the number of conversion events collected on them.
|
|
545
|
+
*/
|
|
546
|
+
type TrendingItemsModel = 'trending-items';
|
|
547
|
+
|
|
548
|
+
type TrendingItems = {
|
|
539
549
|
/**
|
|
540
|
-
*
|
|
550
|
+
* Facet attribute. To be used in combination with `facetValue`. If specified, only recommendations matching the facet filter will be returned.
|
|
541
551
|
*/
|
|
542
|
-
|
|
552
|
+
facetName?: string;
|
|
543
553
|
/**
|
|
544
|
-
*
|
|
554
|
+
* Facet value. To be used in combination with `facetName`. If specified, only recommendations matching the facet filter will be returned.
|
|
545
555
|
*/
|
|
546
|
-
|
|
547
|
-
|
|
556
|
+
facetValue?: string;
|
|
557
|
+
model: TrendingItemsModel;
|
|
558
|
+
fallbackParameters?: SearchParamsObject;
|
|
548
559
|
};
|
|
549
560
|
|
|
561
|
+
type TrendingItemsQuery = BaseRecommendRequest & TrendingItems;
|
|
562
|
+
|
|
563
|
+
type RecommendationsRequest = BoughtTogetherQuery | LookingSimilarQuery | RecommendedForYouQuery | RelatedQuery | TrendingFacetsQuery | TrendingItemsQuery;
|
|
564
|
+
|
|
550
565
|
/**
|
|
551
|
-
*
|
|
566
|
+
* Recommend rules parameters.
|
|
552
567
|
*/
|
|
553
|
-
type
|
|
554
|
-
index?: RedirectRuleIndexMetadata[];
|
|
555
|
-
};
|
|
556
|
-
|
|
557
|
-
type BaseSearchResponse = Record<string, any> & {
|
|
568
|
+
type SearchRecommendRulesParams = {
|
|
558
569
|
/**
|
|
559
|
-
*
|
|
570
|
+
* Search query.
|
|
560
571
|
*/
|
|
561
|
-
|
|
572
|
+
query?: string;
|
|
562
573
|
/**
|
|
563
|
-
*
|
|
574
|
+
* Only search for rules with matching context.
|
|
564
575
|
*/
|
|
565
|
-
|
|
576
|
+
context?: string;
|
|
566
577
|
/**
|
|
567
|
-
*
|
|
578
|
+
* Requested page of the API response.
|
|
568
579
|
*/
|
|
569
|
-
|
|
580
|
+
page?: number;
|
|
570
581
|
/**
|
|
571
|
-
*
|
|
582
|
+
* Maximum number of hits per page.
|
|
572
583
|
*/
|
|
573
|
-
|
|
574
|
-
exhaustive?: Exhaustive;
|
|
584
|
+
hitsPerPage?: number;
|
|
575
585
|
/**
|
|
576
|
-
*
|
|
586
|
+
* Whether to only show rules where the value of their `enabled` property matches this parameter. If absent, show all rules, regardless of their `enabled` property.
|
|
577
587
|
*/
|
|
578
|
-
|
|
588
|
+
enabled?: boolean;
|
|
579
589
|
/**
|
|
580
|
-
*
|
|
590
|
+
* Filter expression. This only searches for rules matching the filter expression.
|
|
581
591
|
*/
|
|
582
|
-
|
|
592
|
+
filters?: string;
|
|
583
593
|
/**
|
|
584
|
-
*
|
|
594
|
+
* Include facets and facet values in the response. Use `[\'*\']` to include all facets.
|
|
585
595
|
*/
|
|
586
|
-
|
|
596
|
+
facets?: string[];
|
|
587
597
|
/**
|
|
588
|
-
*
|
|
598
|
+
* Maximum number of values to return for each facet.
|
|
589
599
|
*/
|
|
590
|
-
|
|
600
|
+
maxValuesPerFacet?: number;
|
|
601
|
+
};
|
|
602
|
+
|
|
603
|
+
/**
|
|
604
|
+
* Properties for the `customDelete` method.
|
|
605
|
+
*/
|
|
606
|
+
type CustomDeleteProps = {
|
|
591
607
|
/**
|
|
592
|
-
*
|
|
608
|
+
* Path of the endpoint, anything after \"/1\" must be specified.
|
|
593
609
|
*/
|
|
594
|
-
|
|
610
|
+
path: string;
|
|
595
611
|
/**
|
|
596
|
-
*
|
|
612
|
+
* Query parameters to apply to the current query.
|
|
597
613
|
*/
|
|
598
|
-
|
|
614
|
+
parameters?: Record<string, any>;
|
|
615
|
+
};
|
|
616
|
+
/**
|
|
617
|
+
* Properties for the `customGet` method.
|
|
618
|
+
*/
|
|
619
|
+
type CustomGetProps = {
|
|
599
620
|
/**
|
|
600
|
-
*
|
|
621
|
+
* Path of the endpoint, anything after \"/1\" must be specified.
|
|
601
622
|
*/
|
|
602
|
-
|
|
623
|
+
path: string;
|
|
603
624
|
/**
|
|
604
|
-
*
|
|
625
|
+
* Query parameters to apply to the current query.
|
|
605
626
|
*/
|
|
606
|
-
|
|
627
|
+
parameters?: Record<string, any>;
|
|
628
|
+
};
|
|
629
|
+
/**
|
|
630
|
+
* Properties for the `customPost` method.
|
|
631
|
+
*/
|
|
632
|
+
type CustomPostProps = {
|
|
607
633
|
/**
|
|
608
|
-
*
|
|
634
|
+
* Path of the endpoint, anything after \"/1\" must be specified.
|
|
609
635
|
*/
|
|
610
|
-
|
|
636
|
+
path: string;
|
|
611
637
|
/**
|
|
612
|
-
*
|
|
638
|
+
* Query parameters to apply to the current query.
|
|
613
639
|
*/
|
|
614
|
-
|
|
640
|
+
parameters?: Record<string, any>;
|
|
615
641
|
/**
|
|
616
|
-
*
|
|
642
|
+
* Parameters to send with the custom request.
|
|
617
643
|
*/
|
|
618
|
-
|
|
644
|
+
body?: Record<string, unknown>;
|
|
645
|
+
};
|
|
646
|
+
/**
|
|
647
|
+
* Properties for the `customPut` method.
|
|
648
|
+
*/
|
|
649
|
+
type CustomPutProps = {
|
|
619
650
|
/**
|
|
620
|
-
*
|
|
651
|
+
* Path of the endpoint, anything after \"/1\" must be specified.
|
|
621
652
|
*/
|
|
622
|
-
|
|
653
|
+
path: string;
|
|
623
654
|
/**
|
|
624
|
-
*
|
|
655
|
+
* Query parameters to apply to the current query.
|
|
625
656
|
*/
|
|
626
|
-
|
|
627
|
-
redirect?: Redirect;
|
|
628
|
-
renderingContent?: RenderingContent;
|
|
657
|
+
parameters?: Record<string, any>;
|
|
629
658
|
/**
|
|
630
|
-
*
|
|
659
|
+
* Parameters to send with the custom request.
|
|
631
660
|
*/
|
|
632
|
-
|
|
661
|
+
body?: Record<string, unknown>;
|
|
662
|
+
};
|
|
663
|
+
/**
|
|
664
|
+
* Properties for the `deleteRecommendRule` method.
|
|
665
|
+
*/
|
|
666
|
+
type DeleteRecommendRuleProps = {
|
|
633
667
|
/**
|
|
634
|
-
*
|
|
668
|
+
* Name of the index on which to perform the operation.
|
|
635
669
|
*/
|
|
636
|
-
|
|
637
|
-
/**
|
|
638
|
-
* An object with custom data. You can store up to 32kB as custom data.
|
|
639
|
-
*/
|
|
640
|
-
userData?: Record<string, unknown>;
|
|
670
|
+
indexName: string;
|
|
641
671
|
/**
|
|
642
|
-
*
|
|
672
|
+
* [Recommend model](https://www.algolia.com/doc/guides/algolia-recommend/overview/#recommend-models).
|
|
643
673
|
*/
|
|
644
|
-
|
|
645
|
-
};
|
|
646
|
-
|
|
647
|
-
/**
|
|
648
|
-
* Frequently bought together model. This model recommends items that have been purchased within 1 day with the item with the ID `objectID`.
|
|
649
|
-
*/
|
|
650
|
-
type FbtModel = 'bought-together';
|
|
651
|
-
|
|
652
|
-
type FrequentlyBoughtTogether = {
|
|
653
|
-
model: FbtModel;
|
|
674
|
+
model: RecommendModels;
|
|
654
675
|
/**
|
|
655
676
|
* Unique record identifier.
|
|
656
677
|
*/
|
|
657
678
|
objectID: string;
|
|
658
679
|
};
|
|
659
|
-
|
|
660
|
-
type BoughtTogetherQuery = BaseRecommendRequest & FrequentlyBoughtTogether;
|
|
661
|
-
|
|
662
680
|
/**
|
|
663
|
-
*
|
|
681
|
+
* Properties for the `getRecommendRule` method.
|
|
664
682
|
*/
|
|
665
|
-
type
|
|
683
|
+
type GetRecommendRuleProps = {
|
|
666
684
|
/**
|
|
667
|
-
*
|
|
685
|
+
* Name of the index on which to perform the operation.
|
|
668
686
|
*/
|
|
669
|
-
|
|
687
|
+
indexName: string;
|
|
670
688
|
/**
|
|
671
|
-
*
|
|
689
|
+
* [Recommend model](https://www.algolia.com/doc/guides/algolia-recommend/overview/#recommend-models).
|
|
672
690
|
*/
|
|
673
|
-
|
|
674
|
-
};
|
|
675
|
-
|
|
676
|
-
/**
|
|
677
|
-
* Object ID of the recommendation you want to exclude.
|
|
678
|
-
*/
|
|
679
|
-
type HideConsequenceObject = {
|
|
691
|
+
model: RecommendModels;
|
|
680
692
|
/**
|
|
681
693
|
* Unique record identifier.
|
|
682
694
|
*/
|
|
683
|
-
objectID
|
|
695
|
+
objectID: string;
|
|
684
696
|
};
|
|
685
|
-
|
|
686
697
|
/**
|
|
687
|
-
*
|
|
698
|
+
* Properties for the `getRecommendStatus` method.
|
|
688
699
|
*/
|
|
689
|
-
type
|
|
700
|
+
type GetRecommendStatusProps = {
|
|
690
701
|
/**
|
|
691
|
-
*
|
|
702
|
+
* Name of the index on which to perform the operation.
|
|
692
703
|
*/
|
|
693
|
-
|
|
704
|
+
indexName: string;
|
|
694
705
|
/**
|
|
695
|
-
*
|
|
706
|
+
* [Recommend model](https://www.algolia.com/doc/guides/algolia-recommend/overview/#recommend-models).
|
|
696
707
|
*/
|
|
697
|
-
|
|
708
|
+
model: RecommendModels;
|
|
698
709
|
/**
|
|
699
|
-
*
|
|
710
|
+
* Unique task identifier.
|
|
700
711
|
*/
|
|
701
|
-
|
|
712
|
+
taskID: number;
|
|
702
713
|
};
|
|
703
|
-
|
|
704
714
|
/**
|
|
705
|
-
*
|
|
715
|
+
* Recommend method signature compatible with the `algoliasearch` v4 package. When using this signature, extra computation will be required to make it match the new signature.
|
|
716
|
+
*
|
|
717
|
+
* @deprecated This signature will be removed from the next major version, we recommend using the `GetRecommendationsParams` type for performances and future proof reasons.
|
|
706
718
|
*/
|
|
707
|
-
type
|
|
708
|
-
/**
|
|
709
|
-
* Unique record identifier.
|
|
710
|
-
*/
|
|
711
|
-
objectID?: string;
|
|
712
|
-
/**
|
|
713
|
-
* Index in the list of recommendations where to place this item.
|
|
714
|
-
*/
|
|
715
|
-
position?: number;
|
|
716
|
-
};
|
|
717
|
-
|
|
719
|
+
type LegacyGetRecommendationsParams = RecommendationsRequest[];
|
|
718
720
|
/**
|
|
719
|
-
*
|
|
721
|
+
* Properties for the `searchRecommendRules` method.
|
|
720
722
|
*/
|
|
721
|
-
type
|
|
723
|
+
type SearchRecommendRulesProps = {
|
|
722
724
|
/**
|
|
723
|
-
*
|
|
725
|
+
* Name of the index on which to perform the operation.
|
|
724
726
|
*/
|
|
725
|
-
|
|
727
|
+
indexName: string;
|
|
726
728
|
/**
|
|
727
|
-
*
|
|
729
|
+
* [Recommend model](https://www.algolia.com/doc/guides/algolia-recommend/overview/#recommend-models).
|
|
728
730
|
*/
|
|
729
|
-
|
|
730
|
-
|
|
731
|
+
model: RecommendModels;
|
|
732
|
+
searchRecommendRulesParams?: SearchRecommendRulesParams;
|
|
731
733
|
};
|
|
732
734
|
|
|
733
735
|
/**
|
|
@@ -744,15 +746,6 @@ type DeletedAtResponse = {
|
|
|
744
746
|
deletedAt: string;
|
|
745
747
|
};
|
|
746
748
|
|
|
747
|
-
/**
|
|
748
|
-
* Error.
|
|
749
|
-
*/
|
|
750
|
-
type ErrorBase = Record<string, any> & {
|
|
751
|
-
message?: string;
|
|
752
|
-
};
|
|
753
|
-
|
|
754
|
-
type FallbackParams = Record<string, unknown> & SearchParamsObject;
|
|
755
|
-
|
|
756
749
|
/**
|
|
757
750
|
* Task status, `published` if the task is completed, `notPublished` otherwise.
|
|
758
751
|
*/
|
|
@@ -763,95 +756,182 @@ type GetRecommendTaskResponse = {
|
|
|
763
756
|
};
|
|
764
757
|
|
|
765
758
|
/**
|
|
766
|
-
*
|
|
759
|
+
* Recommend request body.
|
|
767
760
|
*/
|
|
768
|
-
type
|
|
769
|
-
|
|
770
|
-
type LookingSimilar = {
|
|
771
|
-
model: LookingSimilarModel;
|
|
761
|
+
type GetRecommendationsParams = {
|
|
772
762
|
/**
|
|
773
|
-
*
|
|
763
|
+
* Recommendation request with parameters depending on the requested model.
|
|
774
764
|
*/
|
|
775
|
-
|
|
776
|
-
fallbackParameters?: FallbackParams;
|
|
765
|
+
requests: RecommendationsRequest[];
|
|
777
766
|
};
|
|
778
767
|
|
|
779
|
-
type LookingSimilarQuery = BaseRecommendRequest & LookingSimilar;
|
|
780
|
-
|
|
781
768
|
/**
|
|
782
|
-
*
|
|
769
|
+
* Whether certain properties of the search response are calculated exhaustive (exact) or approximated.
|
|
783
770
|
*/
|
|
784
|
-
type
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
771
|
+
type Exhaustive = {
|
|
772
|
+
/**
|
|
773
|
+
* Whether the facet count is exhaustive (`true`) or approximate (`false`). See the [related discussion](https://support.algolia.com/hc/en-us/articles/4406975248145-Why-are-my-facet-and-hit-counts-not-accurate-).
|
|
774
|
+
*/
|
|
775
|
+
facetsCount?: boolean;
|
|
776
|
+
/**
|
|
777
|
+
* The value is `false` if not all facet values are retrieved.
|
|
778
|
+
*/
|
|
779
|
+
facetValues?: boolean;
|
|
780
|
+
/**
|
|
781
|
+
* Whether the `nbHits` is exhaustive (`true`) or approximate (`false`). When the query takes more than 50ms to be processed, the engine makes an approximation. This can happen when using complex filters on millions of records, when typo-tolerance was not exhaustive, or when enough hits have been retrieved (for example, after the engine finds 10,000 exact matches). `nbHits` is reported as non-exhaustive whenever an approximation is made, even if the approximation didn’t, in the end, impact the exhaustivity of the query.
|
|
782
|
+
*/
|
|
783
|
+
nbHits?: boolean;
|
|
784
|
+
/**
|
|
785
|
+
* Rules matching exhaustivity. The value is `false` if rules were enable for this query, and could not be fully processed due a timeout. This is generally caused by the number of alternatives (such as typos) which is too large.
|
|
786
|
+
*/
|
|
787
|
+
rulesMatch?: boolean;
|
|
788
|
+
/**
|
|
789
|
+
* Whether the typo search was exhaustive (`true`) or approximate (`false`). An approximation is done when the typo search query part takes more than 10% of the query budget (ie. 5ms by default) to be processed (this can happen when a lot of typo alternatives exist for the query). This field will not be included when typo-tolerance is entirely disabled.
|
|
790
|
+
*/
|
|
791
|
+
typo?: boolean;
|
|
789
792
|
};
|
|
790
793
|
|
|
791
|
-
type
|
|
792
|
-
|
|
793
|
-
/**
|
|
794
|
-
* Related products or similar content model. This model recommends items that are similar to the item with the ID `objectID`. Similarity is determined from the user interactions and attributes.
|
|
795
|
-
*/
|
|
796
|
-
type RelatedModel = 'related-products';
|
|
797
|
-
|
|
798
|
-
type RelatedProducts = {
|
|
799
|
-
model: RelatedModel;
|
|
794
|
+
type FacetStats = {
|
|
800
795
|
/**
|
|
801
|
-
*
|
|
796
|
+
* Minimum value in the results.
|
|
802
797
|
*/
|
|
803
|
-
|
|
804
|
-
|
|
798
|
+
min?: number;
|
|
799
|
+
/**
|
|
800
|
+
* Maximum value in the results.
|
|
801
|
+
*/
|
|
802
|
+
max?: number;
|
|
803
|
+
/**
|
|
804
|
+
* Average facet value in the results.
|
|
805
|
+
*/
|
|
806
|
+
avg?: number;
|
|
807
|
+
/**
|
|
808
|
+
* Sum of all values in the results.
|
|
809
|
+
*/
|
|
810
|
+
sum?: number;
|
|
805
811
|
};
|
|
806
812
|
|
|
807
|
-
type RelatedQuery = BaseRecommendRequest & RelatedProducts;
|
|
808
|
-
|
|
809
813
|
/**
|
|
810
|
-
*
|
|
814
|
+
* Redirect rule data.
|
|
811
815
|
*/
|
|
812
|
-
type
|
|
816
|
+
type RedirectRuleIndexData = {
|
|
817
|
+
ruleObjectID: string;
|
|
818
|
+
};
|
|
813
819
|
|
|
814
|
-
type
|
|
820
|
+
type RedirectRuleIndexMetadata = {
|
|
815
821
|
/**
|
|
816
|
-
*
|
|
822
|
+
* Source index for the redirect rule.
|
|
817
823
|
*/
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
824
|
+
source: string;
|
|
825
|
+
/**
|
|
826
|
+
* Destination index for the redirect rule.
|
|
827
|
+
*/
|
|
828
|
+
dest: string;
|
|
829
|
+
/**
|
|
830
|
+
* Reason for the redirect rule.
|
|
831
|
+
*/
|
|
832
|
+
reason: string;
|
|
833
|
+
/**
|
|
834
|
+
* Redirect rule status.
|
|
835
|
+
*/
|
|
836
|
+
succeed: boolean;
|
|
837
|
+
data: RedirectRuleIndexData;
|
|
821
838
|
};
|
|
822
839
|
|
|
823
|
-
type TrendingFacetsQuery = BaseRecommendRequest & TrendingFacets;
|
|
824
|
-
|
|
825
840
|
/**
|
|
826
|
-
*
|
|
841
|
+
* [Redirect results to a URL](https://www.algolia.com/doc/guides/managing-results/rules/merchandising-and-promoting/how-to/redirects/), this this parameter is for internal use only.
|
|
827
842
|
*/
|
|
828
|
-
type
|
|
843
|
+
type Redirect = {
|
|
844
|
+
index?: RedirectRuleIndexMetadata[];
|
|
845
|
+
};
|
|
829
846
|
|
|
830
|
-
type
|
|
847
|
+
type BaseSearchResponse = Record<string, any> & {
|
|
848
|
+
/**
|
|
849
|
+
* A/B test ID. This is only included in the response for indices that are part of an A/B test.
|
|
850
|
+
*/
|
|
851
|
+
abTestID?: number;
|
|
852
|
+
/**
|
|
853
|
+
* Variant ID. This is only included in the response for indices that are part of an A/B test.
|
|
854
|
+
*/
|
|
855
|
+
abTestVariantID?: number;
|
|
856
|
+
/**
|
|
857
|
+
* Computed geographical location.
|
|
858
|
+
*/
|
|
859
|
+
aroundLatLng?: string;
|
|
860
|
+
/**
|
|
861
|
+
* Distance from a central coordinate provided by `aroundLatLng`.
|
|
862
|
+
*/
|
|
863
|
+
automaticRadius?: string;
|
|
864
|
+
exhaustive?: Exhaustive;
|
|
865
|
+
/**
|
|
866
|
+
* See the `facetsCount` field of the `exhaustive` object in the response.
|
|
867
|
+
*/
|
|
868
|
+
exhaustiveFacetsCount?: boolean;
|
|
869
|
+
/**
|
|
870
|
+
* See the `nbHits` field of the `exhaustive` object in the response.
|
|
871
|
+
*/
|
|
872
|
+
exhaustiveNbHits?: boolean;
|
|
873
|
+
/**
|
|
874
|
+
* See the `typo` field of the `exhaustive` object in the response.
|
|
875
|
+
*/
|
|
876
|
+
exhaustiveTypo?: boolean;
|
|
877
|
+
/**
|
|
878
|
+
* Facet counts.
|
|
879
|
+
*/
|
|
880
|
+
facets?: Record<string, Record<string, number>>;
|
|
881
|
+
/**
|
|
882
|
+
* Statistics for numerical facets.
|
|
883
|
+
*/
|
|
884
|
+
facets_stats?: Record<string, FacetStats>;
|
|
885
|
+
/**
|
|
886
|
+
* Index name used for the query.
|
|
887
|
+
*/
|
|
888
|
+
index?: string;
|
|
889
|
+
/**
|
|
890
|
+
* Index name used for the query. During A/B testing, the targeted index isn\'t always the index used by the query.
|
|
891
|
+
*/
|
|
892
|
+
indexUsed?: string;
|
|
893
|
+
/**
|
|
894
|
+
* Warnings about the query.
|
|
895
|
+
*/
|
|
896
|
+
message?: string;
|
|
897
|
+
/**
|
|
898
|
+
* Number of hits selected and sorted by the relevant sort algorithm.
|
|
899
|
+
*/
|
|
900
|
+
nbSortedHits?: number;
|
|
901
|
+
/**
|
|
902
|
+
* Post-[normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean) query string that will be searched.
|
|
903
|
+
*/
|
|
904
|
+
parsedQuery?: string;
|
|
905
|
+
/**
|
|
906
|
+
* Time the server took to process the request, in milliseconds.
|
|
907
|
+
*/
|
|
908
|
+
processingTimeMS: number;
|
|
909
|
+
/**
|
|
910
|
+
* Experimental. List of processing steps and their times, in milliseconds. You can use this list to investigate performance issues.
|
|
911
|
+
*/
|
|
912
|
+
processingTimingsMS?: Record<string, unknown>;
|
|
913
|
+
/**
|
|
914
|
+
* Markup text indicating which parts of the original query have been removed to retrieve a non-empty result set.
|
|
915
|
+
*/
|
|
916
|
+
queryAfterRemoval?: string;
|
|
917
|
+
redirect?: Redirect;
|
|
918
|
+
renderingContent?: RenderingContent;
|
|
831
919
|
/**
|
|
832
|
-
*
|
|
920
|
+
* Time the server took to process the request, in milliseconds.
|
|
833
921
|
*/
|
|
834
|
-
|
|
922
|
+
serverTimeMS?: number;
|
|
835
923
|
/**
|
|
836
|
-
*
|
|
924
|
+
* Host name of the server that processed the request.
|
|
837
925
|
*/
|
|
838
|
-
|
|
839
|
-
model: TrendingItemsModel;
|
|
840
|
-
fallbackParameters?: SearchParamsObject;
|
|
841
|
-
};
|
|
842
|
-
|
|
843
|
-
type TrendingItemsQuery = BaseRecommendRequest & TrendingItems;
|
|
844
|
-
|
|
845
|
-
type RecommendationsRequest = BoughtTogetherQuery | LookingSimilarQuery | RecommendedForYouQuery | RelatedQuery | TrendingFacetsQuery | TrendingItemsQuery;
|
|
846
|
-
|
|
847
|
-
/**
|
|
848
|
-
* Recommend request body.
|
|
849
|
-
*/
|
|
850
|
-
type GetRecommendationsParams = {
|
|
926
|
+
serverUsed?: string;
|
|
851
927
|
/**
|
|
852
|
-
*
|
|
928
|
+
* An object with custom data. You can store up to 32kB as custom data.
|
|
853
929
|
*/
|
|
854
|
-
|
|
930
|
+
userData?: Record<string, unknown>;
|
|
931
|
+
/**
|
|
932
|
+
* Unique identifier for the query. This is used for [click analytics](https://www.algolia.com/doc/guides/analytics/click-analytics/).
|
|
933
|
+
*/
|
|
934
|
+
queryID?: string;
|
|
855
935
|
};
|
|
856
936
|
|
|
857
937
|
/**
|
|
@@ -1052,249 +1132,283 @@ type GetRecommendationsResponse = {
|
|
|
1052
1132
|
results: RecommendationsResults[];
|
|
1053
1133
|
};
|
|
1054
1134
|
|
|
1055
|
-
type RecommendModels = 'bought-together' | 'related-products' | 'trending-facets' | 'trending-items';
|
|
1056
|
-
|
|
1057
1135
|
/**
|
|
1058
|
-
*
|
|
1136
|
+
* Condition that triggers the rule. If not specified, the rule is triggered for all recommendations.
|
|
1059
1137
|
*/
|
|
1060
|
-
type
|
|
1138
|
+
type Condition = {
|
|
1061
1139
|
/**
|
|
1062
|
-
*
|
|
1140
|
+
* Filter expression to only include items that match the filter criteria in the response. You can use these filter expressions: - **Numeric filters.** `<facet> <op> <number>`, where `<op>` is one of `<`, `<=`, `=`, `!=`, `>`, `>=`. - **Ranges.** `<facet>:<lower> TO <upper>` where `<lower>` and `<upper>` are the lower and upper limits of the range (inclusive). - **Facet filters.** `<facet>:<value>` where `<facet>` is a facet attribute (case-sensitive) and `<value>` a facet value. - **Tag filters.** `_tags:<value>` or just `<value>` (case-sensitive). - **Boolean filters.** `<facet>: true | false`. You can combine filters with `AND`, `OR`, and `NOT` operators with the following restrictions: - You can only combine filters of the same type with `OR`. **Not supported:** `facet:value OR num > 3`. - You can\'t use `NOT` with combinations of filters. **Not supported:** `NOT(facet:value OR facet:value)` - You can\'t combine conjunctions (`AND`) with `OR`. **Not supported:** `facet:value OR (facet:value AND facet:value)` Use quotes around your filters, if the facet attribute name or facet value has spaces, keywords (`OR`, `AND`, `NOT`), or quotes. If a facet attribute is an array, the filter matches if it matches at least one element of the array. For more information, see [Filters](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/).
|
|
1063
1141
|
*/
|
|
1064
|
-
|
|
1142
|
+
filters?: string;
|
|
1143
|
+
/**
|
|
1144
|
+
* An additional restriction that only triggers the rule, when the search has the same value as `ruleContexts` parameter. For example, if `context: mobile`, the rule is only triggered when the search request has a matching `ruleContexts: mobile`. A rule context must only contain alphanumeric characters.
|
|
1145
|
+
*/
|
|
1146
|
+
context?: string;
|
|
1065
1147
|
};
|
|
1066
1148
|
|
|
1067
1149
|
/**
|
|
1068
|
-
*
|
|
1150
|
+
* Object ID of the recommendation you want to exclude.
|
|
1069
1151
|
*/
|
|
1070
|
-
type
|
|
1071
|
-
_metadata?: RuleMetadata;
|
|
1152
|
+
type HideConsequenceObject = {
|
|
1072
1153
|
/**
|
|
1073
|
-
* Unique identifier
|
|
1154
|
+
* Unique record identifier.
|
|
1074
1155
|
*/
|
|
1075
1156
|
objectID?: string;
|
|
1076
|
-
condition?: Condition;
|
|
1077
|
-
consequence?: Consequence;
|
|
1078
|
-
/**
|
|
1079
|
-
* Description of the rule\'s purpose. This can be helpful for display in the Algolia dashboard.
|
|
1080
|
-
*/
|
|
1081
|
-
description?: string;
|
|
1082
|
-
/**
|
|
1083
|
-
* Indicates whether to enable the rule. If it isn\'t enabled, it isn\'t applied at query time.
|
|
1084
|
-
*/
|
|
1085
|
-
enabled?: boolean;
|
|
1086
1157
|
};
|
|
1087
1158
|
|
|
1088
1159
|
/**
|
|
1089
|
-
*
|
|
1160
|
+
* Facet attribute. Only recommendations with the same value (or only recommendations with a different value) as the original viewed item are included.
|
|
1090
1161
|
*/
|
|
1091
|
-
type
|
|
1092
|
-
/**
|
|
1093
|
-
* Search query.
|
|
1094
|
-
*/
|
|
1095
|
-
query?: string;
|
|
1096
|
-
/**
|
|
1097
|
-
* Only search for rules with matching context.
|
|
1098
|
-
*/
|
|
1099
|
-
context?: string;
|
|
1100
|
-
/**
|
|
1101
|
-
* Requested page of the API response.
|
|
1102
|
-
*/
|
|
1103
|
-
page?: number;
|
|
1104
|
-
/**
|
|
1105
|
-
* Maximum number of hits per page.
|
|
1106
|
-
*/
|
|
1107
|
-
hitsPerPage?: number;
|
|
1108
|
-
/**
|
|
1109
|
-
* Whether to only show rules where the value of their `enabled` property matches this parameter. If absent, show all rules, regardless of their `enabled` property.
|
|
1110
|
-
*/
|
|
1111
|
-
enabled?: boolean;
|
|
1112
|
-
/**
|
|
1113
|
-
* Filter expression. This only searches for rules matching the filter expression.
|
|
1114
|
-
*/
|
|
1115
|
-
filters?: string;
|
|
1162
|
+
type AutoFacetFilter = {
|
|
1116
1163
|
/**
|
|
1117
|
-
*
|
|
1164
|
+
* Facet attribute.
|
|
1118
1165
|
*/
|
|
1119
|
-
|
|
1166
|
+
facet?: string;
|
|
1120
1167
|
/**
|
|
1121
|
-
*
|
|
1168
|
+
* Whether the filter is negative. If true, recommendations must not have the same value for the `facet` attribute. If false, recommendations must have the same value for the `facet` attribute.
|
|
1122
1169
|
*/
|
|
1123
|
-
|
|
1170
|
+
negative?: boolean;
|
|
1124
1171
|
};
|
|
1125
1172
|
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
hits: RecommendRule[];
|
|
1173
|
+
/**
|
|
1174
|
+
* Filter or boost recommendations matching a facet filter.
|
|
1175
|
+
*/
|
|
1176
|
+
type ParamsConsequence = {
|
|
1131
1177
|
/**
|
|
1132
|
-
*
|
|
1178
|
+
* Filter recommendations that match or don\'t match the same `facet:facet_value` combination as the viewed item.
|
|
1133
1179
|
*/
|
|
1134
|
-
|
|
1180
|
+
automaticFacetFilters?: AutoFacetFilter[];
|
|
1135
1181
|
/**
|
|
1136
|
-
*
|
|
1182
|
+
* Filter expression to only include items that match the filter criteria in the response. You can use these filter expressions: - **Numeric filters.** `<facet> <op> <number>`, where `<op>` is one of `<`, `<=`, `=`, `!=`, `>`, `>=`. - **Ranges.** `<facet>:<lower> TO <upper>` where `<lower>` and `<upper>` are the lower and upper limits of the range (inclusive). - **Facet filters.** `<facet>:<value>` where `<facet>` is a facet attribute (case-sensitive) and `<value>` a facet value. - **Tag filters.** `_tags:<value>` or just `<value>` (case-sensitive). - **Boolean filters.** `<facet>: true | false`. You can combine filters with `AND`, `OR`, and `NOT` operators with the following restrictions: - You can only combine filters of the same type with `OR`. **Not supported:** `facet:value OR num > 3`. - You can\'t use `NOT` with combinations of filters. **Not supported:** `NOT(facet:value OR facet:value)` - You can\'t combine conjunctions (`AND`) with `OR`. **Not supported:** `facet:value OR (facet:value AND facet:value)` Use quotes around your filters, if the facet attribute name or facet value has spaces, keywords (`OR`, `AND`, `NOT`), or quotes. If a facet attribute is an array, the filter matches if it matches at least one element of the array. For more information, see [Filters](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/).
|
|
1137
1183
|
*/
|
|
1138
|
-
|
|
1184
|
+
filters?: string;
|
|
1139
1185
|
/**
|
|
1140
|
-
*
|
|
1186
|
+
* Filters to promote or demote records in the search results. Optional filters work like facet filters, but they don\'t exclude records from the search results. Records that match the optional filter rank before records that don\'t match. Matches with higher weights (`<score=N>`) rank before matches with lower weights. If you\'re using a negative filter `facet:-value`, matching records rank after records that don\'t match.
|
|
1141
1187
|
*/
|
|
1142
|
-
|
|
1188
|
+
optionalFilters?: string[];
|
|
1143
1189
|
};
|
|
1144
1190
|
|
|
1145
1191
|
/**
|
|
1146
|
-
*
|
|
1192
|
+
* Object ID and position of the recommendation you want to pin.
|
|
1147
1193
|
*/
|
|
1148
|
-
type
|
|
1194
|
+
type PromoteConsequenceObject = {
|
|
1149
1195
|
/**
|
|
1150
|
-
*
|
|
1196
|
+
* Unique record identifier.
|
|
1151
1197
|
*/
|
|
1152
|
-
|
|
1198
|
+
objectID?: string;
|
|
1153
1199
|
/**
|
|
1154
|
-
*
|
|
1200
|
+
* Index in the list of recommendations where to place this item.
|
|
1155
1201
|
*/
|
|
1156
|
-
|
|
1202
|
+
position?: number;
|
|
1157
1203
|
};
|
|
1204
|
+
|
|
1158
1205
|
/**
|
|
1159
|
-
*
|
|
1206
|
+
* Effect of the rule.
|
|
1160
1207
|
*/
|
|
1161
|
-
type
|
|
1208
|
+
type Consequence = {
|
|
1162
1209
|
/**
|
|
1163
|
-
*
|
|
1210
|
+
* Exclude items from recommendations.
|
|
1164
1211
|
*/
|
|
1165
|
-
|
|
1212
|
+
hide?: HideConsequenceObject[];
|
|
1166
1213
|
/**
|
|
1167
|
-
*
|
|
1214
|
+
* Place items at specific positions in the list of recommendations.
|
|
1168
1215
|
*/
|
|
1169
|
-
|
|
1216
|
+
promote?: PromoteConsequenceObject[];
|
|
1217
|
+
params?: ParamsConsequence;
|
|
1170
1218
|
};
|
|
1219
|
+
|
|
1171
1220
|
/**
|
|
1172
|
-
*
|
|
1221
|
+
* Rule metadata.
|
|
1173
1222
|
*/
|
|
1174
|
-
type
|
|
1175
|
-
/**
|
|
1176
|
-
* Path of the endpoint, anything after \"/1\" must be specified.
|
|
1177
|
-
*/
|
|
1178
|
-
path: string;
|
|
1179
|
-
/**
|
|
1180
|
-
* Query parameters to apply to the current query.
|
|
1181
|
-
*/
|
|
1182
|
-
parameters?: Record<string, any>;
|
|
1223
|
+
type RuleMetadata = {
|
|
1183
1224
|
/**
|
|
1184
|
-
*
|
|
1225
|
+
* Date and time when the object was updated, in RFC 3339 format.
|
|
1185
1226
|
*/
|
|
1186
|
-
|
|
1227
|
+
lastUpdate?: string;
|
|
1187
1228
|
};
|
|
1229
|
+
|
|
1188
1230
|
/**
|
|
1189
|
-
*
|
|
1231
|
+
* Recommend rule.
|
|
1190
1232
|
*/
|
|
1191
|
-
type
|
|
1233
|
+
type RecommendRule = {
|
|
1234
|
+
_metadata?: RuleMetadata;
|
|
1192
1235
|
/**
|
|
1193
|
-
*
|
|
1236
|
+
* Unique identifier of a rule object.
|
|
1194
1237
|
*/
|
|
1195
|
-
|
|
1238
|
+
objectID?: string;
|
|
1239
|
+
condition?: Condition;
|
|
1240
|
+
consequence?: Consequence;
|
|
1196
1241
|
/**
|
|
1197
|
-
*
|
|
1242
|
+
* Description of the rule\'s purpose. This can be helpful for display in the Algolia dashboard.
|
|
1198
1243
|
*/
|
|
1199
|
-
|
|
1244
|
+
description?: string;
|
|
1200
1245
|
/**
|
|
1201
|
-
*
|
|
1246
|
+
* Indicates whether to enable the rule. If it isn\'t enabled, it isn\'t applied at query time.
|
|
1202
1247
|
*/
|
|
1203
|
-
|
|
1248
|
+
enabled?: boolean;
|
|
1204
1249
|
};
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
*/
|
|
1208
|
-
type DeleteRecommendRuleProps = {
|
|
1209
|
-
/**
|
|
1210
|
-
* Name of the index on which to perform the operation.
|
|
1211
|
-
*/
|
|
1212
|
-
indexName: string;
|
|
1213
|
-
/**
|
|
1214
|
-
* [Recommend model](https://www.algolia.com/doc/guides/algolia-recommend/overview/#recommend-models).
|
|
1215
|
-
*/
|
|
1216
|
-
model: RecommendModels;
|
|
1250
|
+
|
|
1251
|
+
type SearchRecommendRulesResponse = {
|
|
1217
1252
|
/**
|
|
1218
|
-
*
|
|
1253
|
+
* Recommend rules that match the search criteria.
|
|
1219
1254
|
*/
|
|
1220
|
-
|
|
1221
|
-
};
|
|
1222
|
-
/**
|
|
1223
|
-
* Properties for the `getRecommendRule` method.
|
|
1224
|
-
*/
|
|
1225
|
-
type GetRecommendRuleProps = {
|
|
1255
|
+
hits: RecommendRule[];
|
|
1226
1256
|
/**
|
|
1227
|
-
*
|
|
1257
|
+
* Number of results (hits).
|
|
1228
1258
|
*/
|
|
1229
|
-
|
|
1259
|
+
nbHits: number;
|
|
1230
1260
|
/**
|
|
1231
|
-
*
|
|
1261
|
+
* Page of search results to retrieve.
|
|
1232
1262
|
*/
|
|
1233
|
-
|
|
1263
|
+
page: number;
|
|
1234
1264
|
/**
|
|
1235
|
-
*
|
|
1265
|
+
* Number of pages of results.
|
|
1236
1266
|
*/
|
|
1237
|
-
|
|
1267
|
+
nbPages: number;
|
|
1238
1268
|
};
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1269
|
+
|
|
1270
|
+
declare const apiClientVersion = "5.3.0";
|
|
1271
|
+
declare function createRecommendClient({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, ...options }: CreateClientOptions): {
|
|
1272
|
+
transporter: _algolia_client_common.Transporter;
|
|
1243
1273
|
/**
|
|
1244
|
-
*
|
|
1274
|
+
* The `appId` currently in use.
|
|
1245
1275
|
*/
|
|
1246
|
-
|
|
1276
|
+
appId: string;
|
|
1247
1277
|
/**
|
|
1248
|
-
*
|
|
1278
|
+
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
|
|
1249
1279
|
*/
|
|
1250
|
-
|
|
1280
|
+
clearCache(): Promise<void>;
|
|
1251
1281
|
/**
|
|
1252
|
-
*
|
|
1282
|
+
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
|
|
1253
1283
|
*/
|
|
1254
|
-
|
|
1255
|
-
};
|
|
1256
|
-
/**
|
|
1257
|
-
* Recommend method signature compatible with the `algoliasearch` v4 package. When using this signature, extra computation will be required to make it match the new signature.
|
|
1258
|
-
*
|
|
1259
|
-
* @deprecated This signature will be removed from the next major version, we recommend using the `GetRecommendationsParams` type for performances and future proof reasons.
|
|
1260
|
-
*/
|
|
1261
|
-
type LegacyGetRecommendationsParams = RecommendationsRequest[];
|
|
1262
|
-
/**
|
|
1263
|
-
* Properties for the `searchRecommendRules` method.
|
|
1264
|
-
*/
|
|
1265
|
-
type SearchRecommendRulesProps = {
|
|
1284
|
+
readonly _ua: string;
|
|
1266
1285
|
/**
|
|
1267
|
-
*
|
|
1286
|
+
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
|
|
1287
|
+
*
|
|
1288
|
+
* @param segment - The algolia agent (user-agent) segment to add.
|
|
1289
|
+
* @param version - The version of the agent.
|
|
1268
1290
|
*/
|
|
1269
|
-
|
|
1291
|
+
addAlgoliaAgent(segment: string, version?: string): void;
|
|
1270
1292
|
/**
|
|
1271
|
-
*
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1293
|
+
* Helper method to switch the API key used to authenticate the requests.
|
|
1294
|
+
*
|
|
1295
|
+
* @param params - Method params.
|
|
1296
|
+
* @param params.apiKey - The new API Key to use.
|
|
1297
|
+
*/
|
|
1298
|
+
setClientApiKey({ apiKey }: {
|
|
1299
|
+
apiKey: string;
|
|
1300
|
+
}): void;
|
|
1301
|
+
/**
|
|
1302
|
+
* This method allow you to send requests to the Algolia REST API.
|
|
1303
|
+
*
|
|
1304
|
+
* @param customDelete - The customDelete object.
|
|
1305
|
+
* @param customDelete.path - Path of the endpoint, anything after \"/1\" must be specified.
|
|
1306
|
+
* @param customDelete.parameters - Query parameters to apply to the current query.
|
|
1307
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1308
|
+
*/
|
|
1309
|
+
customDelete({ path, parameters }: CustomDeleteProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
|
|
1310
|
+
/**
|
|
1311
|
+
* This method allow you to send requests to the Algolia REST API.
|
|
1312
|
+
*
|
|
1313
|
+
* @param customGet - The customGet object.
|
|
1314
|
+
* @param customGet.path - Path of the endpoint, anything after \"/1\" must be specified.
|
|
1315
|
+
* @param customGet.parameters - Query parameters to apply to the current query.
|
|
1316
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1317
|
+
*/
|
|
1318
|
+
customGet({ path, parameters }: CustomGetProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
|
|
1319
|
+
/**
|
|
1320
|
+
* This method allow you to send requests to the Algolia REST API.
|
|
1321
|
+
*
|
|
1322
|
+
* @param customPost - The customPost object.
|
|
1323
|
+
* @param customPost.path - Path of the endpoint, anything after \"/1\" must be specified.
|
|
1324
|
+
* @param customPost.parameters - Query parameters to apply to the current query.
|
|
1325
|
+
* @param customPost.body - Parameters to send with the custom request.
|
|
1326
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1327
|
+
*/
|
|
1328
|
+
customPost({ path, parameters, body }: CustomPostProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
|
|
1329
|
+
/**
|
|
1330
|
+
* This method allow you to send requests to the Algolia REST API.
|
|
1331
|
+
*
|
|
1332
|
+
* @param customPut - The customPut object.
|
|
1333
|
+
* @param customPut.path - Path of the endpoint, anything after \"/1\" must be specified.
|
|
1334
|
+
* @param customPut.parameters - Query parameters to apply to the current query.
|
|
1335
|
+
* @param customPut.body - Parameters to send with the custom request.
|
|
1336
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1337
|
+
*/
|
|
1338
|
+
customPut({ path, parameters, body }: CustomPutProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
|
|
1339
|
+
/**
|
|
1340
|
+
* Deletes a Recommend rule from a recommendation scenario.
|
|
1341
|
+
*
|
|
1342
|
+
* Required API Key ACLs:
|
|
1343
|
+
* - editSettings.
|
|
1344
|
+
*
|
|
1345
|
+
* @param deleteRecommendRule - The deleteRecommendRule object.
|
|
1346
|
+
* @param deleteRecommendRule.indexName - Name of the index on which to perform the operation.
|
|
1347
|
+
* @param deleteRecommendRule.model - [Recommend model](https://www.algolia.com/doc/guides/algolia-recommend/overview/#recommend-models).
|
|
1348
|
+
* @param deleteRecommendRule.objectID - Unique record identifier.
|
|
1349
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1350
|
+
*/
|
|
1351
|
+
deleteRecommendRule({ indexName, model, objectID }: DeleteRecommendRuleProps, requestOptions?: RequestOptions): Promise<DeletedAtResponse>;
|
|
1352
|
+
/**
|
|
1353
|
+
* Retrieves a Recommend rule that you previously created in the Algolia dashboard.
|
|
1354
|
+
*
|
|
1355
|
+
* Required API Key ACLs:
|
|
1356
|
+
* - settings.
|
|
1357
|
+
*
|
|
1358
|
+
* @param getRecommendRule - The getRecommendRule object.
|
|
1359
|
+
* @param getRecommendRule.indexName - Name of the index on which to perform the operation.
|
|
1360
|
+
* @param getRecommendRule.model - [Recommend model](https://www.algolia.com/doc/guides/algolia-recommend/overview/#recommend-models).
|
|
1361
|
+
* @param getRecommendRule.objectID - Unique record identifier.
|
|
1362
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1363
|
+
*/
|
|
1364
|
+
getRecommendRule({ indexName, model, objectID }: GetRecommendRuleProps, requestOptions?: RequestOptions): Promise<RecommendRule>;
|
|
1365
|
+
/**
|
|
1366
|
+
* Checks the status of a given task. Deleting a Recommend rule is asynchronous. When you delete a rule, a task is created on a queue and completed depending on the load on the server. The API response includes a task ID that you can use to check the status.
|
|
1367
|
+
*
|
|
1368
|
+
* Required API Key ACLs:
|
|
1369
|
+
* - editSettings.
|
|
1370
|
+
*
|
|
1371
|
+
* @param getRecommendStatus - The getRecommendStatus object.
|
|
1372
|
+
* @param getRecommendStatus.indexName - Name of the index on which to perform the operation.
|
|
1373
|
+
* @param getRecommendStatus.model - [Recommend model](https://www.algolia.com/doc/guides/algolia-recommend/overview/#recommend-models).
|
|
1374
|
+
* @param getRecommendStatus.taskID - Unique task identifier.
|
|
1375
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1376
|
+
*/
|
|
1377
|
+
getRecommendStatus({ indexName, model, taskID }: GetRecommendStatusProps, requestOptions?: RequestOptions): Promise<GetRecommendTaskResponse>;
|
|
1378
|
+
/**
|
|
1379
|
+
* Retrieves recommendations from selected AI models.
|
|
1380
|
+
*
|
|
1381
|
+
* Required API Key ACLs:
|
|
1382
|
+
* - search.
|
|
1383
|
+
*
|
|
1384
|
+
* @param getRecommendationsParams - The getRecommendationsParams object.
|
|
1385
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1386
|
+
*/
|
|
1387
|
+
getRecommendations(getRecommendationsParams: GetRecommendationsParams | LegacyGetRecommendationsParams, requestOptions?: RequestOptions): Promise<GetRecommendationsResponse>;
|
|
1388
|
+
/**
|
|
1389
|
+
* Searches for Recommend rules. Use an empty query to list all rules for this recommendation scenario.
|
|
1390
|
+
*
|
|
1391
|
+
* Required API Key ACLs:
|
|
1392
|
+
* - settings.
|
|
1393
|
+
*
|
|
1394
|
+
* @param searchRecommendRules - The searchRecommendRules object.
|
|
1395
|
+
* @param searchRecommendRules.indexName - Name of the index on which to perform the operation.
|
|
1396
|
+
* @param searchRecommendRules.model - [Recommend model](https://www.algolia.com/doc/guides/algolia-recommend/overview/#recommend-models).
|
|
1397
|
+
* @param searchRecommendRules.searchRecommendRulesParams - The searchRecommendRulesParams object.
|
|
1398
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1399
|
+
*/
|
|
1400
|
+
searchRecommendRules({ indexName, model, searchRecommendRulesParams }: SearchRecommendRulesProps, requestOptions?: RequestOptions): Promise<SearchRecommendRulesResponse>;
|
|
1275
1401
|
};
|
|
1276
1402
|
|
|
1277
|
-
declare const apiClientVersion = "5.2.5";
|
|
1278
|
-
|
|
1279
1403
|
/**
|
|
1280
|
-
*
|
|
1404
|
+
* Error.
|
|
1281
1405
|
*/
|
|
1282
|
-
type
|
|
1283
|
-
|
|
1284
|
-
transporter: _algolia_client_common.Transporter;
|
|
1285
|
-
appId: string;
|
|
1286
|
-
clearCache(): Promise<void>;
|
|
1287
|
-
_ua: string;
|
|
1288
|
-
addAlgoliaAgent(segment: string, version?: string): void;
|
|
1289
|
-
customDelete({ path, parameters }: CustomDeleteProps, requestOptions?: _algolia_client_common.RequestOptions): Promise<Record<string, unknown>>;
|
|
1290
|
-
customGet({ path, parameters }: CustomGetProps, requestOptions?: _algolia_client_common.RequestOptions): Promise<Record<string, unknown>>;
|
|
1291
|
-
customPost({ path, parameters, body }: CustomPostProps, requestOptions?: _algolia_client_common.RequestOptions): Promise<Record<string, unknown>>;
|
|
1292
|
-
customPut({ path, parameters, body }: CustomPutProps, requestOptions?: _algolia_client_common.RequestOptions): Promise<Record<string, unknown>>;
|
|
1293
|
-
deleteRecommendRule({ indexName, model, objectID }: DeleteRecommendRuleProps, requestOptions?: _algolia_client_common.RequestOptions): Promise<DeletedAtResponse>;
|
|
1294
|
-
getRecommendRule({ indexName, model, objectID }: GetRecommendRuleProps, requestOptions?: _algolia_client_common.RequestOptions): Promise<RecommendRule>;
|
|
1295
|
-
getRecommendStatus({ indexName, model, taskID }: GetRecommendStatusProps, requestOptions?: _algolia_client_common.RequestOptions): Promise<GetRecommendTaskResponse>;
|
|
1296
|
-
getRecommendations(getRecommendationsParams: GetRecommendationsParams | LegacyGetRecommendationsParams, requestOptions?: _algolia_client_common.RequestOptions): Promise<GetRecommendationsResponse>;
|
|
1297
|
-
searchRecommendRules({ indexName, model, searchRecommendRulesParams }: SearchRecommendRulesProps, requestOptions?: _algolia_client_common.RequestOptions): Promise<SearchRecommendRulesResponse>;
|
|
1406
|
+
type ErrorBase = Record<string, any> & {
|
|
1407
|
+
message?: string;
|
|
1298
1408
|
};
|
|
1299
1409
|
|
|
1410
|
+
type RecommendClient = ReturnType<typeof createRecommendClient>;
|
|
1411
|
+
|
|
1412
|
+
declare function recommendClient(appId: string, apiKey: string, options?: ClientOptions): RecommendClient;
|
|
1413
|
+
|
|
1300
1414
|
export { type AdvancedSyntaxFeatures, type AlternativesAsExact, type AroundPrecision, type AroundRadius, type AroundRadiusAll, type AutoFacetFilter, type BaseRecommendRequest, type BaseSearchParams, type BaseSearchParamsWithoutQuery, type BaseSearchResponse, type BooleanString, type BoughtTogetherQuery, type Condition, type Consequence, type CustomDeleteProps, type CustomGetProps, type CustomPostProps, type CustomPutProps, type DeleteRecommendRuleProps, type DeletedAtResponse, type Distinct, type ErrorBase, type ExactOnSingleWordQuery, type Exhaustive, type FacetFilters, type FacetOrdering, type FacetStats, type Facets, type FallbackParams, type FbtModel, type FrequentlyBoughtTogether, type GetRecommendRuleProps, type GetRecommendStatusProps, type GetRecommendTaskResponse, type GetRecommendationsParams, type GetRecommendationsResponse, type HideConsequenceObject, type HighlightResult, type HighlightResultOption, type IgnorePlurals, type IndexSettingsAsSearchParams, type LegacyGetRecommendationsParams, type LookingSimilar, type LookingSimilarModel, type LookingSimilarQuery, type MatchLevel, type MatchedGeoLocation, type Mode, type NumericFilters, type OptionalFilters, type ParamsConsequence, type Personalization, type PromoteConsequenceObject, type QueryType, type Range, type RankingInfo, type ReRankingApplyFilter, type RecommendClient, type RecommendHit, type RecommendModels, type RecommendRule, type RecommendationsHit, type RecommendationsHits, type RecommendationsRequest, type RecommendationsResults, type RecommendedForYou, type RecommendedForYouModel, type RecommendedForYouQuery, type Redirect, type RedirectRuleIndexData, type RedirectRuleIndexMetadata, type RedirectURL, type RelatedModel, type RelatedProducts, type RelatedQuery, type RemoveStopWords, type RemoveWordsIfNoResults, type RenderingContent, type RuleMetadata, type SearchPagination, type SearchParams, type SearchParamsObject, type SearchParamsQuery, type SearchRecommendRulesParams, type SearchRecommendRulesProps, type SearchRecommendRulesResponse, type SemanticSearch, type SnippetResult, type SnippetResultOption, type SortRemainingBy, type SupportedLanguage, type TagFilters, type TaskStatus, type TrendingFacetHit, type TrendingFacets, type TrendingFacetsModel, type TrendingFacetsQuery, type TrendingItems, type TrendingItemsModel, type TrendingItemsQuery, type TypoTolerance, type TypoToleranceEnum, type Value, apiClientVersion, recommendClient };
|