@findlane/server 0.35.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 +51 -3
- package/dist/index.d.ts +51 -3
- package/package.json +1 -1
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
|
|
@@ -430,12 +447,17 @@ export type SearchRequest = {
|
|
|
430
447
|
* subindexes count as one search (0.25.0). */
|
|
431
448
|
subindexes?: Record<string, Omit<SearchRequest, "subindexes"> | true>;
|
|
432
449
|
/** The facet values the query names (0.34.0): `true` for every field of the index's facetMatches setting, or
|
|
433
|
-
* `{ fields }` for some of them. They come back in `facetMatches`.
|
|
450
|
+
* `{ fields }` for some of them. They come back in `facetMatches`. With the setting's `apply`, a match that names a
|
|
451
|
+
* value exactly filters this search (`applied`, with `rewrittenQuery`); `apply` chooses for this search instead (0.36.0). */
|
|
434
452
|
facetMatches?: boolean | {
|
|
435
453
|
fields?: string[];
|
|
454
|
+
apply?: FacetMatchApply;
|
|
436
455
|
};
|
|
437
456
|
};
|
|
438
|
-
/**
|
|
457
|
+
/** When a search that asks applies a facet match's filter (0.36.0): never (the default), when the match is the whole
|
|
458
|
+
* query, or whenever it names a value exactly, searching the query's other words. */
|
|
459
|
+
export type FacetMatchApply = "never" | "whole" | "exact";
|
|
460
|
+
/** The facetMatches setting (0.34.0); see IndexSettings. A field's `apply` goes over the setting's. */
|
|
439
461
|
export type FacetMatchesSetting = {
|
|
440
462
|
fields: Array<{
|
|
441
463
|
field: string;
|
|
@@ -445,13 +467,15 @@ export type FacetMatchesSetting = {
|
|
|
445
467
|
only?: "labelled";
|
|
446
468
|
hide?: string[];
|
|
447
469
|
link?: string;
|
|
470
|
+
apply?: FacetMatchApply;
|
|
448
471
|
}>;
|
|
472
|
+
apply?: FacetMatchApply;
|
|
449
473
|
perField?: number;
|
|
450
474
|
};
|
|
451
475
|
/** A facet value a query names (0.34.0): the field's `values` it stands for (several when values share a label),
|
|
452
476
|
* its `label`, its `count` of records the search's filters allow, how it matched (`match`: exact, prefix, typo,
|
|
453
477
|
* or contains, a later word of the value), whether it took every word (`whole`), where those words are in `q`
|
|
454
|
-
* (`typed`, UTF-16 offsets), its `link`, a `filter` for it, and whether the search applied it (
|
|
478
|
+
* (`typed`, UTF-16 offsets), its `link`, a `filter` for it, and whether the search applied it (`applied`, 0.36.0). */
|
|
455
479
|
export type FacetMatch = {
|
|
456
480
|
field: string;
|
|
457
481
|
values: string[];
|
|
@@ -492,6 +516,26 @@ export type GeoBox = {
|
|
|
492
516
|
east: number;
|
|
493
517
|
west: number;
|
|
494
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
|
+
};
|
|
495
539
|
/** How a query word matched: as itself, as the start of a longer word, within its typos, through a synonym,
|
|
496
540
|
* as another form of the word in the index's languages (a plural or another spelling, or with `inflections`
|
|
497
541
|
* an Icelandic case or plural), or, with the
|
|
@@ -607,6 +651,10 @@ export type SearchResponse<T> = {
|
|
|
607
651
|
sort?: string;
|
|
608
652
|
/** With `near`: the point distances are from, or null when the visitor's location isn't known. */
|
|
609
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[];
|
|
610
658
|
/** With the index's `didYouMean` setting: the query with the words typo tolerance corrected, when the
|
|
611
659
|
* results matched some words only by typo ("Showing results for …"), else null. */
|
|
612
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
|
|
@@ -430,12 +447,17 @@ export type SearchRequest = {
|
|
|
430
447
|
* subindexes count as one search (0.25.0). */
|
|
431
448
|
subindexes?: Record<string, Omit<SearchRequest, "subindexes"> | true>;
|
|
432
449
|
/** The facet values the query names (0.34.0): `true` for every field of the index's facetMatches setting, or
|
|
433
|
-
* `{ fields }` for some of them. They come back in `facetMatches`.
|
|
450
|
+
* `{ fields }` for some of them. They come back in `facetMatches`. With the setting's `apply`, a match that names a
|
|
451
|
+
* value exactly filters this search (`applied`, with `rewrittenQuery`); `apply` chooses for this search instead (0.36.0). */
|
|
434
452
|
facetMatches?: boolean | {
|
|
435
453
|
fields?: string[];
|
|
454
|
+
apply?: FacetMatchApply;
|
|
436
455
|
};
|
|
437
456
|
};
|
|
438
|
-
/**
|
|
457
|
+
/** When a search that asks applies a facet match's filter (0.36.0): never (the default), when the match is the whole
|
|
458
|
+
* query, or whenever it names a value exactly, searching the query's other words. */
|
|
459
|
+
export type FacetMatchApply = "never" | "whole" | "exact";
|
|
460
|
+
/** The facetMatches setting (0.34.0); see IndexSettings. A field's `apply` goes over the setting's. */
|
|
439
461
|
export type FacetMatchesSetting = {
|
|
440
462
|
fields: Array<{
|
|
441
463
|
field: string;
|
|
@@ -445,13 +467,15 @@ export type FacetMatchesSetting = {
|
|
|
445
467
|
only?: "labelled";
|
|
446
468
|
hide?: string[];
|
|
447
469
|
link?: string;
|
|
470
|
+
apply?: FacetMatchApply;
|
|
448
471
|
}>;
|
|
472
|
+
apply?: FacetMatchApply;
|
|
449
473
|
perField?: number;
|
|
450
474
|
};
|
|
451
475
|
/** A facet value a query names (0.34.0): the field's `values` it stands for (several when values share a label),
|
|
452
476
|
* its `label`, its `count` of records the search's filters allow, how it matched (`match`: exact, prefix, typo,
|
|
453
477
|
* or contains, a later word of the value), whether it took every word (`whole`), where those words are in `q`
|
|
454
|
-
* (`typed`, UTF-16 offsets), its `link`, a `filter` for it, and whether the search applied it (
|
|
478
|
+
* (`typed`, UTF-16 offsets), its `link`, a `filter` for it, and whether the search applied it (`applied`, 0.36.0). */
|
|
455
479
|
export type FacetMatch = {
|
|
456
480
|
field: string;
|
|
457
481
|
values: string[];
|
|
@@ -492,6 +516,26 @@ export type GeoBox = {
|
|
|
492
516
|
east: number;
|
|
493
517
|
west: number;
|
|
494
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
|
+
};
|
|
495
539
|
/** How a query word matched: as itself, as the start of a longer word, within its typos, through a synonym,
|
|
496
540
|
* as another form of the word in the index's languages (a plural or another spelling, or with `inflections`
|
|
497
541
|
* an Icelandic case or plural), or, with the
|
|
@@ -607,6 +651,10 @@ export type SearchResponse<T> = {
|
|
|
607
651
|
sort?: string;
|
|
608
652
|
/** With `near`: the point distances are from, or null when the visitor's location isn't known. */
|
|
609
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[];
|
|
610
658
|
/** With the index's `didYouMean` setting: the query with the words typo tolerance corrected, when the
|
|
611
659
|
* results matched some words only by typo ("Showing results for …"), else null. */
|
|
612
660
|
didYouMean?: DidYouMean | null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@findlane/server",
|
|
3
|
-
"version": "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",
|