@algolia/client-search 4.3.0 → 4.5.1

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.
@@ -288,6 +288,15 @@ export declare type ConsequencePromote = {
288
288
  * Promoted rank for the object (zero-based).
289
289
  */
290
290
  readonly position: number;
291
+ } | {
292
+ /**
293
+ * List of unique identifiers for the objects to promote.
294
+ */
295
+ readonly objectIDs: readonly string[];
296
+ /**
297
+ * Promoted start rank for the objects (zero-based).
298
+ */
299
+ readonly position: number;
291
300
  };
292
301
 
293
302
  export declare type ConsequenceQuery = {
@@ -558,7 +567,7 @@ export declare type GetObjectsResponse<TObject> = {
558
567
  /**
559
568
  * The list of results.
560
569
  */
561
- results: Array<TObject & ObjectWithObjectID>;
570
+ results: Array<(TObject & ObjectWithObjectID) | null>;
562
571
  };
563
572
 
564
573
  export declare const getRule: (base: SearchIndex) => (objectID: string, requestOptions?: RequestOptions | undefined) => Readonly<Promise<Rule>>;
@@ -614,6 +623,41 @@ export declare type HasPendingMappingsResponse = {
614
623
  };
615
624
  };
616
625
 
626
+ declare type HighlightMatch = {
627
+ readonly value: string;
628
+ readonly matchLevel: 'none' | 'partial' | 'full';
629
+ readonly matchedWords: readonly string[];
630
+ readonly fullyHighlighted?: boolean;
631
+ };
632
+
633
+ export declare type HighlightResult<THit> = THit extends string | number ? HighlightMatch : {
634
+ [KAttribute in keyof THit]: HighlightResult<THit[KAttribute]>;
635
+ };
636
+
637
+ export declare type Hit<THit> = THit & {
638
+ readonly objectID: string;
639
+ readonly _highlightResult?: HighlightResult<THit>;
640
+ readonly _snippetResult?: SnippetResult<THit>;
641
+ readonly _rankingInfo?: {
642
+ readonly promoted: boolean;
643
+ readonly nbTypos: number;
644
+ readonly firstMatchedWord: number;
645
+ readonly proximityDistance?: number;
646
+ readonly geoDistance: number;
647
+ readonly geoPrecision?: number;
648
+ readonly nbExactWords: number;
649
+ readonly words: number;
650
+ readonly filters: number;
651
+ readonly userScore: number;
652
+ readonly matchedGeoLocation?: {
653
+ readonly lat: number;
654
+ readonly lng: number;
655
+ readonly distance: number;
656
+ };
657
+ };
658
+ readonly _distinctSeqID?: number;
659
+ };
660
+
617
661
  export declare type IndexOperationResponse = {
618
662
  /**
619
663
  * The operation task id. May be used to perform a wait task.
@@ -872,7 +916,7 @@ export declare type MultipleQueriesResponse<TObject> = {
872
916
  /**
873
917
  * The list of results.
874
918
  */
875
- results: Array<SearchResponse<TObject & ObjectWithObjectID>>;
919
+ results: Array<SearchResponse<TObject>>;
876
920
  };
877
921
 
878
922
  export declare const multipleSearchForFacetValues: (base: SearchClient) => (queries: readonly {
@@ -949,8 +993,14 @@ export declare type Rule = {
949
993
  readonly objectID: string;
950
994
  /**
951
995
  * Condition of the rule, expressed using the following variables: pattern, anchoring, context.
996
+ *
997
+ * @deprecated This parameter is deprecated in favor of `conditions`.
952
998
  */
953
999
  readonly condition?: Condition;
1000
+ /**
1001
+ * Conditions of the rule, expressed using the following variables: pattern, anchoring, context.
1002
+ */
1003
+ readonly conditions?: readonly Condition[];
954
1004
  /**
955
1005
  * Consequence of the rule. At least one of the following object must be used: params, promote, hide, userData.
956
1006
  */
@@ -1430,7 +1480,7 @@ export declare type SearchResponse<TObject = {}> = {
1430
1480
  *
1431
1481
  * Hits are ordered according to the ranking or sorting of the index being queried.
1432
1482
  */
1433
- hits: Array<TObject & ObjectWithObjectID>;
1483
+ hits: Array<Hit<TObject>>;
1434
1484
  /**
1435
1485
  * Index of the current page (zero-based).
1436
1486
  */
@@ -1970,6 +2020,15 @@ export declare type Settings = {
1970
2020
  readonly userData?: any;
1971
2021
  };
1972
2022
 
2023
+ declare type SnippetMatch = {
2024
+ readonly value: string;
2025
+ readonly matchLevel: 'none' | 'partial' | 'full';
2026
+ };
2027
+
2028
+ export declare type SnippetResult<THit> = THit extends string | number ? SnippetMatch : {
2029
+ [KAttribute in keyof THit]: SnippetResult<THit[KAttribute]>;
2030
+ };
2031
+
1973
2032
  export declare const StrategyEnum: Readonly<Record<string, StrategyType>>;
1974
2033
 
1975
2034
  export declare type StrategyType = 'none' | 'stopIfEnoughMatches';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@algolia/client-search",
3
- "version": "4.3.0",
3
+ "version": "4.5.1",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -16,8 +16,8 @@
16
16
  "dist"
17
17
  ],
18
18
  "dependencies": {
19
- "@algolia/client-common": "4.3.0",
20
- "@algolia/requester-common": "4.3.0",
21
- "@algolia/transporter": "4.3.0"
19
+ "@algolia/client-common": "4.5.1",
20
+ "@algolia/requester-common": "4.5.1",
21
+ "@algolia/transporter": "4.5.1"
22
22
  }
23
23
  }