@findlane/server 0.36.0 → 0.37.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
@@ -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?: string[];
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,26 @@ 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 group of matches: how many, their average place, and the box around them. A box with no size means every record is at one place. */
528
+ export type Cluster = {
529
+ count: number;
530
+ lat: number;
531
+ lng: number;
532
+ bounds: GeoBox;
533
+ stats?: Record<string, {
534
+ min: number;
535
+ max: number;
536
+ avg: number;
537
+ }>;
538
+ };
502
539
  /** How a query word matched: as itself, as the start of a longer word, within its typos, through a synonym,
503
540
  * as another form of the word in the index's languages (a plural or another spelling, or with `inflections`
504
541
  * an Icelandic case or plural), or, with the
@@ -614,6 +651,10 @@ export type SearchResponse<T> = {
614
651
  sort?: string;
615
652
  /** With `near`: the point distances are from, or null when the visitor's location isn't known. */
616
653
  near?: GeoPoint | null;
654
+ /** With `bounds`: the box around every match with a place on the map, or null without any. */
655
+ bounds?: GeoBox | null;
656
+ /** With `clusters`: one for each cell with matches. */
657
+ clusters?: Cluster[];
617
658
  /** With the index's `didYouMean` setting: the query with the words typo tolerance corrected, when the
618
659
  * results matched some words only by typo ("Showing results for …"), else null. */
619
660
  didYouMean?: DidYouMean | null;
package/dist/index.d.ts CHANGED
@@ -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?: string[];
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,26 @@ 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 group of matches: how many, their average place, and the box around them. A box with no size means every record is at one place. */
528
+ export type Cluster = {
529
+ count: number;
530
+ lat: number;
531
+ lng: number;
532
+ bounds: GeoBox;
533
+ stats?: Record<string, {
534
+ min: number;
535
+ max: number;
536
+ avg: number;
537
+ }>;
538
+ };
502
539
  /** How a query word matched: as itself, as the start of a longer word, within its typos, through a synonym,
503
540
  * as another form of the word in the index's languages (a plural or another spelling, or with `inflections`
504
541
  * an Icelandic case or plural), or, with the
@@ -614,6 +651,10 @@ export type SearchResponse<T> = {
614
651
  sort?: string;
615
652
  /** With `near`: the point distances are from, or null when the visitor's location isn't known. */
616
653
  near?: GeoPoint | null;
654
+ /** With `bounds`: the box around every match with a place on the map, or null without any. */
655
+ bounds?: GeoBox | null;
656
+ /** With `clusters`: one for each cell with matches. */
657
+ clusters?: Cluster[];
617
658
  /** With the index's `didYouMean` setting: the query with the words typo tolerance corrected, when the
618
659
  * results matched some words only by typo ("Showing results for …"), else null. */
619
660
  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.37.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",