@findlane/browser 0.12.0 → 0.13.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.ts +20 -3
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,13 @@ export type SearchRequest = {
|
|
|
2
2
|
q?: string;
|
|
3
3
|
/** A sort ID from the index settings, "relevance", or "distance" (with `near`). */
|
|
4
4
|
sort?: string;
|
|
5
|
-
/** Field values to keep
|
|
5
|
+
/** Field values to keep. Each field takes a value (a list field contains it), or an object of
|
|
6
|
+
* conditions that all apply: `in` (any of up to 100 values), `all` (a list field has every one),
|
|
7
|
+
* `not` and `notIn` (records without the field stay in), and `gte`/`lte` for numbers and dates, such
|
|
8
|
+
* as `{ tags: { in: ["kids", "adult"], notIn: ["party"] }, price: { lte: 50 } }`. `"$or"` takes one to
|
|
9
|
+
* four groups of field filters and keeps records that match any group:
|
|
10
|
+
* `{ inStock: true, $or: [{ brand: "Acme" }, { price: { lte: 20 } }] }`. Up to 20 field filters,
|
|
11
|
+
* counting those in groups. */
|
|
6
12
|
filters?: Record<string, unknown>;
|
|
7
13
|
facets?: string[];
|
|
8
14
|
/** Facets (also in `facets`) counted without the filter on their own field, so a list of choices
|
|
@@ -81,6 +87,16 @@ export type SearchResponse<T> = {
|
|
|
81
87
|
/** With the index's `didYouMean` setting: the query with the words typo tolerance corrected, when the
|
|
82
88
|
* results matched some words only by typo ("Showing results for …"), else null. */
|
|
83
89
|
didYouMean?: DidYouMean | null;
|
|
90
|
+
/** The index's query rules the query fired, in the index's order, with their `userData`, such as a banner
|
|
91
|
+
* to show or a page to go to. Left out when none fired. */
|
|
92
|
+
appliedRules?: AppliedRule[];
|
|
93
|
+
/** When a rule replaced words: the query that was searched. */
|
|
94
|
+
rewrittenQuery?: string;
|
|
95
|
+
};
|
|
96
|
+
/** A query rule a search fired, with its `userData`, if it has any. */
|
|
97
|
+
export type AppliedRule = {
|
|
98
|
+
id: string;
|
|
99
|
+
userData?: unknown;
|
|
84
100
|
};
|
|
85
101
|
/** A corrected query. `applied`: the results are already for `q` (a search's "Showing results for");
|
|
86
102
|
* otherwise searching `q` finds results that the query didn't ("Did you mean"). `changes` lists each
|
|
@@ -97,8 +113,9 @@ export type DidYouMean = {
|
|
|
97
113
|
export type RecommendationsRequest = {
|
|
98
114
|
/** Up to this many products in each list, 1 to 20; 8 by default. */
|
|
99
115
|
limit?: number;
|
|
100
|
-
/** Only picks matching these filters, as in a search, such as `{ inStock: true }`.
|
|
101
|
-
*
|
|
116
|
+
/** Only picks matching these filters, as in a search, such as `{ inStock: true }`. Each field's filter
|
|
117
|
+
* takes the same shapes; `$or` is for searches only. The index's browser access decides which fields
|
|
118
|
+
* may be filtered by. */
|
|
102
119
|
filters?: SearchRequest["filters"];
|
|
103
120
|
/** The record fields to return; by default, those the index's browser access returns. */
|
|
104
121
|
attributesToRetrieve?: string[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@findlane/browser",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "Findlane browser SDK: fast, typo-tolerant public search from the browser with an index's public ID, plus React hooks and components.",
|
|
5
5
|
"keywords": ["findlane", "search", "full-text search", "typo tolerance", "instant search", "ecommerce search", "browser", "react", "autocomplete"],
|
|
6
6
|
"license": "MIT",
|