@findlane/server 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.
package/dist/index.d.cts CHANGED
@@ -66,6 +66,14 @@ export type IndexSettings = {
66
66
  /** Query suggestions: whole searches offered as shoppers type, and popular searches for an empty box,
67
67
  * from what shoppers search and the catalog. On by default. Changes apply within a few minutes. */
68
68
  querySuggestions?: QuerySuggestionSettings;
69
+ /** Related results (0.18.0): when a search's words find nothing, the products closest to it in meaning, in
70
+ * the response's `related`. Paid plans, indexes of up to 200,000 records. Turned on, every record is
71
+ * embedded within minutes, and `minScore`, the floor, is calibrated from the index's own searches that
72
+ * found nothing; none show until it is. Off by default. */
73
+ relatedResults?: {
74
+ enabled?: boolean;
75
+ minScore?: number | null;
76
+ };
69
77
  normalizationProfile?: "default-v2" | "default-v1" | "icelandic-ascii-v1";
70
78
  /** An object field of lat and lng numbers, such as `_geoloc`, that `near` and `within` search; null for none. */
71
79
  locationField?: string | null;
@@ -335,6 +343,8 @@ export type SearchRequest = {
335
343
  /** Only records inside a box, in degrees, such as a map's visible area. West greater than east crosses the
336
344
  * antimeridian. */
337
345
  within?: GeoBox;
346
+ /** With the index's `relatedResults` on: false asks for no related results (0.18.0). */
347
+ related?: boolean;
338
348
  };
339
349
  /** A point in degrees: lat from -90 to 90, lng from -180 to 180. */
340
350
  export type GeoPoint = {
@@ -441,6 +451,17 @@ export type SearchResponse<T> = {
441
451
  appliedRules?: AppliedRule[];
442
452
  /** When a rule replaced words: the query that was searched. */
443
453
  rewrittenQuery?: string;
454
+ /** With the index's `relatedResults` on (0.18.0): when the query's words found nothing (`hits` empty,
455
+ * `total` 0), the products closest to it in meaning, best first, with their similarity as `score`. Show
456
+ * them under a heading of their own, such as "No exact matches. Related products". */
457
+ related?: {
458
+ hits: Array<{
459
+ id: string;
460
+ score: number | null;
461
+ record: T;
462
+ }>;
463
+ total: number;
464
+ };
444
465
  };
445
466
  /** How a product's recommendations are served (the recommendations add-on). */
446
467
  /** One of an index's lists (docs: Lists): a row of products, such as Popular or New arrivals, from a filter and
@@ -626,7 +647,7 @@ export type ServerEvent = {
626
647
  objectID: string;
627
648
  position?: number;
628
649
  query?: string;
629
- list?: "goesWith" | "similar" | "together";
650
+ list?: "goesWith" | "similar" | "together" | "related";
630
651
  from?: string;
631
652
  timestamp?: number;
632
653
  } | {
package/dist/index.d.ts CHANGED
@@ -66,6 +66,14 @@ export type IndexSettings = {
66
66
  /** Query suggestions: whole searches offered as shoppers type, and popular searches for an empty box,
67
67
  * from what shoppers search and the catalog. On by default. Changes apply within a few minutes. */
68
68
  querySuggestions?: QuerySuggestionSettings;
69
+ /** Related results (0.18.0): when a search's words find nothing, the products closest to it in meaning, in
70
+ * the response's `related`. Paid plans, indexes of up to 200,000 records. Turned on, every record is
71
+ * embedded within minutes, and `minScore`, the floor, is calibrated from the index's own searches that
72
+ * found nothing; none show until it is. Off by default. */
73
+ relatedResults?: {
74
+ enabled?: boolean;
75
+ minScore?: number | null;
76
+ };
69
77
  normalizationProfile?: "default-v2" | "default-v1" | "icelandic-ascii-v1";
70
78
  /** An object field of lat and lng numbers, such as `_geoloc`, that `near` and `within` search; null for none. */
71
79
  locationField?: string | null;
@@ -335,6 +343,8 @@ export type SearchRequest = {
335
343
  /** Only records inside a box, in degrees, such as a map's visible area. West greater than east crosses the
336
344
  * antimeridian. */
337
345
  within?: GeoBox;
346
+ /** With the index's `relatedResults` on: false asks for no related results (0.18.0). */
347
+ related?: boolean;
338
348
  };
339
349
  /** A point in degrees: lat from -90 to 90, lng from -180 to 180. */
340
350
  export type GeoPoint = {
@@ -441,6 +451,17 @@ export type SearchResponse<T> = {
441
451
  appliedRules?: AppliedRule[];
442
452
  /** When a rule replaced words: the query that was searched. */
443
453
  rewrittenQuery?: string;
454
+ /** With the index's `relatedResults` on (0.18.0): when the query's words found nothing (`hits` empty,
455
+ * `total` 0), the products closest to it in meaning, best first, with their similarity as `score`. Show
456
+ * them under a heading of their own, such as "No exact matches. Related products". */
457
+ related?: {
458
+ hits: Array<{
459
+ id: string;
460
+ score: number | null;
461
+ record: T;
462
+ }>;
463
+ total: number;
464
+ };
444
465
  };
445
466
  /** How a product's recommendations are served (the recommendations add-on). */
446
467
  /** One of an index's lists (docs: Lists): a row of products, such as Popular or New arrivals, from a filter and
@@ -626,7 +647,7 @@ export type ServerEvent = {
626
647
  objectID: string;
627
648
  position?: number;
628
649
  query?: string;
629
- list?: "goesWith" | "similar" | "together";
650
+ list?: "goesWith" | "similar" | "together" | "related";
630
651
  from?: string;
631
652
  timestamp?: number;
632
653
  } | {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@findlane/server",
3
- "version": "0.17.0",
3
+ "version": "0.18.0",
4
4
  "description": "Findlane server SDK: upload catalogs, manage index settings, and search with a secret workspace API key.",
5
5
  "keywords": ["findlane", "search", "full-text search", "typo tolerance", "ecommerce search", "search api", "sdk"],
6
6
  "license": "MIT",