@findlane/server 0.36.0 → 0.38.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
@@ -341,7 +341,7 @@ export type PublicSearchPolicy = {
341
341
  sortIds?: string[];
342
342
  /** With `sortIds`: the sort browsers get when they ask for none. */
343
343
  defaultSort?: string;
344
- /** Whether browser search may use `near` and `within`, which show roughly where each record is. */
344
+ /** Whether browser search may use `near`, `within`, `tile`, `bounds`, `clusters` and `spread`, which show roughly where each record is. */
345
345
  location?: boolean;
346
346
  };
347
347
  export type PublicSearchAccess = {
@@ -408,6 +408,23 @@ export type SearchRequest = {
408
408
  /** Only records inside a box, in degrees, such as a map's visible area. West greater than east crosses the
409
409
  * antimeridian. */
410
410
  within?: GeoBox;
411
+ /** Only records on a map tile, instead of `near` or `within`, numbered as web maps number them. A record is on exactly one tile
412
+ * of a zoom, so tiles add up. Needs the index's location field. */
413
+ tile?: MapTile;
414
+ /** Answers with `bounds`, the box around every match rather than only the page. */
415
+ bounds?: boolean;
416
+ /** With `tile`: answers with `clusters`, its matches grouped by cell. `stats` takes up to three number fields, as `facetStats` does.
417
+ * `limit: 0` then gives no hits. */
418
+ clusters?: {
419
+ cells: MapCells;
420
+ stats?: ClusterStat[];
421
+ };
422
+ /** With `tile`: the page is each cell's best records (`perCell`, 1 by default, up to 10) rather than the top of one list. It takes
423
+ * no `offset`, and `distinct` stays off. */
424
+ spread?: {
425
+ cells: MapCells;
426
+ perCell?: number;
427
+ };
411
428
  /** With the index's `relatedResults` on: false asks for no related results (0.18.0). */
412
429
  related?: boolean;
413
430
  /** With the index's `distinct` setting: false shows every record, a number 1 to 4 how many of each group's
@@ -499,6 +516,33 @@ export type GeoBox = {
499
516
  east: number;
500
517
  west: number;
501
518
  };
519
+ /** A map tile, numbered as MapLibre and other web maps number them. */
520
+ export type MapTile = {
521
+ z: number;
522
+ x: number;
523
+ y: number;
524
+ };
525
+ /** Cells a side of a map tile. */
526
+ export type MapCells = 1 | 2 | 4 | 8 | 16;
527
+ /** A number field in clusters' stats, by its name. With `gt`, values at or below it are left out of the stat, such as a price of 0
528
+ * that means no price. Those records stay in the cluster's `count`. */
529
+ export type ClusterStat = string | {
530
+ field: string;
531
+ gt?: number;
532
+ };
533
+ /** A group of matches: how many, their average place, and the box around them. A box with no size means every record is at one
534
+ * place. `stats` leaves out a field no record has a value of. */
535
+ export type Cluster = {
536
+ count: number;
537
+ lat: number;
538
+ lng: number;
539
+ bounds: GeoBox;
540
+ stats?: Record<string, {
541
+ min: number;
542
+ max: number;
543
+ avg: number;
544
+ }>;
545
+ };
502
546
  /** How a query word matched: as itself, as the start of a longer word, within its typos, through a synonym,
503
547
  * as another form of the word in the index's languages (a plural or another spelling, or with `inflections`
504
548
  * an Icelandic case or plural), or, with the
@@ -614,6 +658,10 @@ export type SearchResponse<T> = {
614
658
  sort?: string;
615
659
  /** With `near`: the point distances are from, or null when the visitor's location isn't known. */
616
660
  near?: GeoPoint | null;
661
+ /** With `bounds`: the box around every match with a place on the map, or null without any. */
662
+ bounds?: GeoBox | null;
663
+ /** With `clusters`: one for each cell with matches. */
664
+ clusters?: Cluster[];
617
665
  /** With the index's `didYouMean` setting: the query with the words typo tolerance corrected, when the
618
666
  * results matched some words only by typo ("Showing results for …"), else null. */
619
667
  didYouMean?: DidYouMean | null;
package/dist/index.d.ts CHANGED
@@ -341,7 +341,7 @@ export type PublicSearchPolicy = {
341
341
  sortIds?: string[];
342
342
  /** With `sortIds`: the sort browsers get when they ask for none. */
343
343
  defaultSort?: string;
344
- /** Whether browser search may use `near` and `within`, which show roughly where each record is. */
344
+ /** Whether browser search may use `near`, `within`, `tile`, `bounds`, `clusters` and `spread`, which show roughly where each record is. */
345
345
  location?: boolean;
346
346
  };
347
347
  export type PublicSearchAccess = {
@@ -408,6 +408,23 @@ export type SearchRequest = {
408
408
  /** Only records inside a box, in degrees, such as a map's visible area. West greater than east crosses the
409
409
  * antimeridian. */
410
410
  within?: GeoBox;
411
+ /** Only records on a map tile, instead of `near` or `within`, numbered as web maps number them. A record is on exactly one tile
412
+ * of a zoom, so tiles add up. Needs the index's location field. */
413
+ tile?: MapTile;
414
+ /** Answers with `bounds`, the box around every match rather than only the page. */
415
+ bounds?: boolean;
416
+ /** With `tile`: answers with `clusters`, its matches grouped by cell. `stats` takes up to three number fields, as `facetStats` does.
417
+ * `limit: 0` then gives no hits. */
418
+ clusters?: {
419
+ cells: MapCells;
420
+ stats?: ClusterStat[];
421
+ };
422
+ /** With `tile`: the page is each cell's best records (`perCell`, 1 by default, up to 10) rather than the top of one list. It takes
423
+ * no `offset`, and `distinct` stays off. */
424
+ spread?: {
425
+ cells: MapCells;
426
+ perCell?: number;
427
+ };
411
428
  /** With the index's `relatedResults` on: false asks for no related results (0.18.0). */
412
429
  related?: boolean;
413
430
  /** With the index's `distinct` setting: false shows every record, a number 1 to 4 how many of each group's
@@ -499,6 +516,33 @@ export type GeoBox = {
499
516
  east: number;
500
517
  west: number;
501
518
  };
519
+ /** A map tile, numbered as MapLibre and other web maps number them. */
520
+ export type MapTile = {
521
+ z: number;
522
+ x: number;
523
+ y: number;
524
+ };
525
+ /** Cells a side of a map tile. */
526
+ export type MapCells = 1 | 2 | 4 | 8 | 16;
527
+ /** A number field in clusters' stats, by its name. With `gt`, values at or below it are left out of the stat, such as a price of 0
528
+ * that means no price. Those records stay in the cluster's `count`. */
529
+ export type ClusterStat = string | {
530
+ field: string;
531
+ gt?: number;
532
+ };
533
+ /** A group of matches: how many, their average place, and the box around them. A box with no size means every record is at one
534
+ * place. `stats` leaves out a field no record has a value of. */
535
+ export type Cluster = {
536
+ count: number;
537
+ lat: number;
538
+ lng: number;
539
+ bounds: GeoBox;
540
+ stats?: Record<string, {
541
+ min: number;
542
+ max: number;
543
+ avg: number;
544
+ }>;
545
+ };
502
546
  /** How a query word matched: as itself, as the start of a longer word, within its typos, through a synonym,
503
547
  * as another form of the word in the index's languages (a plural or another spelling, or with `inflections`
504
548
  * an Icelandic case or plural), or, with the
@@ -614,6 +658,10 @@ export type SearchResponse<T> = {
614
658
  sort?: string;
615
659
  /** With `near`: the point distances are from, or null when the visitor's location isn't known. */
616
660
  near?: GeoPoint | null;
661
+ /** With `bounds`: the box around every match with a place on the map, or null without any. */
662
+ bounds?: GeoBox | null;
663
+ /** With `clusters`: one for each cell with matches. */
664
+ clusters?: Cluster[];
617
665
  /** With the index's `didYouMean` setting: the query with the words typo tolerance corrected, when the
618
666
  * results matched some words only by typo ("Showing results for …"), else null. */
619
667
  didYouMean?: DidYouMean | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@findlane/server",
3
- "version": "0.36.0",
3
+ "version": "0.38.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",