@findlane/browser 0.17.0 → 0.18.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.
Files changed (2) hide show
  1. package/dist/index.d.ts +18 -0
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -48,6 +48,9 @@ export type SearchRequest = {
48
48
  within?: GeoBox;
49
49
  /** With the index's related results on: false asks for none (0.17.0). */
50
50
  related?: boolean;
51
+ /** With the index's `distinct` setting, which shows each product once, such as one of its colours: false
52
+ * shows every record, a number 1 to 4 how many of each group's records. */
53
+ distinct?: boolean | number;
51
54
  };
52
55
  /** A point in degrees: lat from -90 to 90, lng from -180 to 180. */
53
56
  export type GeoPoint = {
@@ -70,10 +73,25 @@ export type SearchHit<T> = {
70
73
  distance?: number;
71
74
  /** With `highlight`: matched searchable fields by path; list fields give one string per value. */
72
75
  highlights?: Record<string, string | string[]>;
76
+ /** With the index's `distinct` setting: the hit's group (its value of the group field, null for a record
77
+ * without one) and how many of the group's records matched. */
78
+ group?: {
79
+ value: string | number | null;
80
+ matched: number;
81
+ };
82
+ /** With the index's `variants` setting: which item of the record's variants list the search matched, by
83
+ * its words or by filters on the variants' fields, such as the flavour a shopper typed. Absent when none
84
+ * stands out. */
85
+ variant?: {
86
+ index: number;
87
+ };
73
88
  };
74
89
  export type SearchResponse<T> = {
75
90
  hits: SearchHit<T>[];
91
+ /** The matches; with the index's `distinct` setting, the groups. */
76
92
  total: number;
93
+ /** With `distinct`: the matching records, which `total` counts as groups. */
94
+ totalRecords?: number;
77
95
  /** "gte" when `total` is a lower bound (page count mode). */
78
96
  totalRelation?: "eq" | "gte";
79
97
  hasMore?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@findlane/browser",
3
- "version": "0.17.0",
3
+ "version": "0.18.0",
4
4
  "description": "Findlane browser SDK: fast, typo-tolerant public search from the browser with an index's public ID, plus React hooks and components.",
5
5
  "keywords": ["findlane", "search", "full-text search", "typo tolerance", "instant search", "ecommerce search", "browser", "react", "autocomplete"],
6
6
  "license": "MIT",