@findlane/server 0.20.0 → 0.22.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
@@ -386,6 +386,11 @@ export type SearchRequest = {
386
386
  /** Contexts the page sends, which rules with a `context` condition fire on, such as "category-page": a
387
387
  * name or up to 10, each 1 to 64 letters, digits, `_`, `:` or `-` (0.20.0). */
388
388
  context?: string | string[];
389
+ /** Records matching these filters come first, after the index's rank first, in searches by relevance: filters as
390
+ * `filters` takes them, or a list of up to 10, each counting once, so records matching more come first (0.21.0). */
391
+ boost?: SearchRequest["filters"] | SearchRequest["filters"][];
392
+ /** Records matching these come last, the same way (0.21.0). */
393
+ bury?: SearchRequest["filters"] | SearchRequest["filters"][];
389
394
  /** Checks rules as at this time, in milliseconds since 1970, such as a campaign's start, instead of now
390
395
  * (0.20.0). Browser search doesn't take it. */
391
396
  rulesAt?: number;
@@ -458,6 +463,14 @@ export type AppliedRule = {
458
463
  id: string;
459
464
  userData?: unknown;
460
465
  };
466
+ /** A rule's banner: an image, where it links, its text, its place among the hits from 1, and the rule's ID. */
467
+ export type Banner = {
468
+ image: string;
469
+ link?: string;
470
+ title?: string;
471
+ position?: number;
472
+ rule: string;
473
+ };
461
474
  export type SearchResponse<T> = {
462
475
  hits: {
463
476
  id: string;
@@ -512,6 +525,11 @@ export type SearchResponse<T> = {
512
525
  appliedRules?: AppliedRule[];
513
526
  /** When a rule replaced words: the query that was searched. */
514
527
  rewrittenQuery?: string;
528
+ /** Banners of the rules that fired, in their order (0.21.0): show each at its `position` among the hits (from
529
+ * 1; the top when left out), linking to `link`. */
530
+ banners?: Banner[];
531
+ /** A page a rule sends this search to, such as "/pages/returns" (0.21.0): go there instead of showing results. */
532
+ redirect?: string;
515
533
  /** With the index's `relatedResults` on (0.18.0): when the query's words found nothing (`hits` empty,
516
534
  * `total` 0), the products closest to it in meaning, best first, with their similarity as `score`. Show
517
535
  * them under a heading of their own, such as "No exact matches. Related products". */
@@ -727,6 +745,15 @@ export type ServerEvent = {
727
745
  | {
728
746
  type: "cancel";
729
747
  orderID: string;
748
+ }
749
+ /** A rule's banner was clicked: its rule, as search responses give it with the banner, the search's
750
+ * query, and its place. */
751
+ | {
752
+ type: "bannerClick";
753
+ rule: string;
754
+ query?: string;
755
+ position?: number;
756
+ timestamp?: number;
730
757
  };
731
758
  /** A past order for importOrders; `timestamp` is when it was placed (ms, a Date, or an ISO string). */
732
759
  export type Order = {
package/dist/index.d.ts CHANGED
@@ -386,6 +386,11 @@ export type SearchRequest = {
386
386
  /** Contexts the page sends, which rules with a `context` condition fire on, such as "category-page": a
387
387
  * name or up to 10, each 1 to 64 letters, digits, `_`, `:` or `-` (0.20.0). */
388
388
  context?: string | string[];
389
+ /** Records matching these filters come first, after the index's rank first, in searches by relevance: filters as
390
+ * `filters` takes them, or a list of up to 10, each counting once, so records matching more come first (0.21.0). */
391
+ boost?: SearchRequest["filters"] | SearchRequest["filters"][];
392
+ /** Records matching these come last, the same way (0.21.0). */
393
+ bury?: SearchRequest["filters"] | SearchRequest["filters"][];
389
394
  /** Checks rules as at this time, in milliseconds since 1970, such as a campaign's start, instead of now
390
395
  * (0.20.0). Browser search doesn't take it. */
391
396
  rulesAt?: number;
@@ -458,6 +463,14 @@ export type AppliedRule = {
458
463
  id: string;
459
464
  userData?: unknown;
460
465
  };
466
+ /** A rule's banner: an image, where it links, its text, its place among the hits from 1, and the rule's ID. */
467
+ export type Banner = {
468
+ image: string;
469
+ link?: string;
470
+ title?: string;
471
+ position?: number;
472
+ rule: string;
473
+ };
461
474
  export type SearchResponse<T> = {
462
475
  hits: {
463
476
  id: string;
@@ -512,6 +525,11 @@ export type SearchResponse<T> = {
512
525
  appliedRules?: AppliedRule[];
513
526
  /** When a rule replaced words: the query that was searched. */
514
527
  rewrittenQuery?: string;
528
+ /** Banners of the rules that fired, in their order (0.21.0): show each at its `position` among the hits (from
529
+ * 1; the top when left out), linking to `link`. */
530
+ banners?: Banner[];
531
+ /** A page a rule sends this search to, such as "/pages/returns" (0.21.0): go there instead of showing results. */
532
+ redirect?: string;
515
533
  /** With the index's `relatedResults` on (0.18.0): when the query's words found nothing (`hits` empty,
516
534
  * `total` 0), the products closest to it in meaning, best first, with their similarity as `score`. Show
517
535
  * them under a heading of their own, such as "No exact matches. Related products". */
@@ -727,6 +745,15 @@ export type ServerEvent = {
727
745
  | {
728
746
  type: "cancel";
729
747
  orderID: string;
748
+ }
749
+ /** A rule's banner was clicked: its rule, as search responses give it with the banner, the search's
750
+ * query, and its place. */
751
+ | {
752
+ type: "bannerClick";
753
+ rule: string;
754
+ query?: string;
755
+ position?: number;
756
+ timestamp?: number;
730
757
  };
731
758
  /** A past order for importOrders; `timestamp` is when it was placed (ms, a Date, or an ISO string). */
732
759
  export type Order = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@findlane/server",
3
- "version": "0.20.0",
3
+ "version": "0.22.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",