typesense-instantsearch-adapter 2.6.0-0 → 2.6.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/README.md +0 -40
- package/dist/typesense-instantsearch-adapter.js +2 -6
- package/dist/typesense-instantsearch-adapter.js.map +1 -1
- package/dist/typesense-instantsearch-adapter.min.js +1 -1
- package/dist/typesense-instantsearch-adapter.min.js.map +1 -1
- package/lib/Configuration.js +0 -1
- package/lib/Configuration.js.map +1 -1
- package/lib/SearchResponseAdapter.js +2 -5
- package/lib/SearchResponseAdapter.js.map +1 -1
- package/package.json +3 -3
- package/src/Configuration.js +0 -2
- package/src/SearchResponseAdapter.js +0 -1
package/README.md
CHANGED
|
@@ -365,50 +365,10 @@ const typesenseInstantsearchAdapter = new TypesenseInstantSearchAdapter({
|
|
|
365
365
|
});
|
|
366
366
|
```
|
|
367
367
|
|
|
368
|
-
### `dynamicWidgets`
|
|
369
|
-
|
|
370
|
-
> Available as of Typesense Server `v0.25.0.rc12`
|
|
371
|
-
|
|
372
|
-
In order to use [`dynamicWidgets`](https://www.algolia.com/doc/api-reference/widgets/dynamic-facets/js/),
|
|
373
|
-
Instantsearch expects a parameter called [`renderingContent`](https://www.algolia.com/doc/api-reference/api-parameters/renderingContent/) to be set
|
|
374
|
-
which controls the display logic for this widget.
|
|
375
|
-
|
|
376
|
-
In Algolia, this configuration can be set via the dashboard or via the API.
|
|
377
|
-
But when using Typesense and this adapter, this setting has to be configured when instantiating the adapter like this:
|
|
378
|
-
|
|
379
|
-
```js
|
|
380
|
-
const typesenseInstantsearchAdapter = new TypesenseInstantSearchAdapter({
|
|
381
|
-
server: {
|
|
382
|
-
apiKey: "xyz",
|
|
383
|
-
nodes: [
|
|
384
|
-
{
|
|
385
|
-
host: "localhost",
|
|
386
|
-
port: "8108",
|
|
387
|
-
path: "/",
|
|
388
|
-
protocol: "http",
|
|
389
|
-
},
|
|
390
|
-
],
|
|
391
|
-
},
|
|
392
|
-
renderingContent: {
|
|
393
|
-
// <<====== Required
|
|
394
|
-
facetOrdering: {
|
|
395
|
-
// <<====== Required: this controls the order in which the dynamic facets are displayed, and is *required* for the dynamicWidget to render
|
|
396
|
-
facets: {
|
|
397
|
-
order: ["size", "brand"], // <<===== Change this as needed
|
|
398
|
-
},
|
|
399
|
-
},
|
|
400
|
-
},
|
|
401
|
-
additionalSearchParameters,
|
|
402
|
-
});
|
|
403
|
-
```
|
|
404
|
-
|
|
405
|
-
Read more about all available options for `renderingContent` in [Algolia's documentation here](https://www.algolia.com/doc/api-reference/api-parameters/renderingContent/?client=javascript#examples).
|
|
406
|
-
|
|
407
368
|
## Compatibility
|
|
408
369
|
|
|
409
370
|
| Typesense Server | typesense-instantsearch-adapter | instantsearch.js | react-instantsearch | vue-instantsearch | angular-instantsearch |
|
|
410
371
|
| ---------------- | ------------------------------- | ---------------- | ------------------- | ----------------- | --------------------- |
|
|
411
|
-
| \>= v0.25.0.rc12 | \>= v2.6.0 | \>= 4.51 | \>= 6.39 | \>= 4.8 | \>= 4.4 |
|
|
412
372
|
| \>= v0.24 | \>= v2.5.0 | \>= 4.2.0 | \>= 6.0.0 | \>= 2.2.1 | \>= 3.0.0 |
|
|
413
373
|
| \>= v0.21 | \>= v2.0.0 | \>= 4.2.0 | \>= 6.0.0 | \>= 2.2.1 | \>= 3.0.0 |
|
|
414
374
|
| \>= v0.19 | \>= v1.0.0 | \>= 4.2.0 | \>= 6.0.0 | \>= 2.2.1 | \>= 3.0.0 |
|
|
@@ -2250,7 +2250,6 @@ var Configuration = /*#__PURE__*/function () {
|
|
|
2250
2250
|
return params[key] === undefined ? delete params[key] : {};
|
|
2251
2251
|
});
|
|
2252
2252
|
});
|
|
2253
|
-
this.renderingContent = options.renderingContent;
|
|
2254
2253
|
}
|
|
2255
2254
|
|
|
2256
2255
|
(0,_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__["default"])(Configuration, [{
|
|
@@ -3075,7 +3074,7 @@ var SearchResponseAdapter = /*#__PURE__*/function () {
|
|
|
3075
3074
|
}, {
|
|
3076
3075
|
key: "adapt",
|
|
3077
3076
|
value: function adapt() {
|
|
3078
|
-
var adaptedResult =
|
|
3077
|
+
var adaptedResult = {
|
|
3079
3078
|
hits: this.typesenseResponse.grouped_hits ? this._adaptGroupedHits(this.typesenseResponse.grouped_hits) : this._adaptHits(this.typesenseResponse.hits),
|
|
3080
3079
|
nbHits: this.typesenseResponse.found,
|
|
3081
3080
|
page: this.typesenseResponse.page - 1,
|
|
@@ -3085,10 +3084,7 @@ var SearchResponseAdapter = /*#__PURE__*/function () {
|
|
|
3085
3084
|
facets_stats: this._adaptFacetStats(this.typesenseResponse.facet_counts || {}),
|
|
3086
3085
|
query: this.typesenseResponse.request_params.q,
|
|
3087
3086
|
processingTimeMS: this.typesenseResponse.search_time_ms
|
|
3088
|
-
}
|
|
3089
|
-
renderingContent: this.configuration.renderingContent
|
|
3090
|
-
}); // console.log(adaptedResult);
|
|
3091
|
-
|
|
3087
|
+
}; // console.log(adaptedResult);
|
|
3092
3088
|
|
|
3093
3089
|
return adaptedResult;
|
|
3094
3090
|
}
|