typesense-instantsearch-adapter 2.5.0-7 → 2.5.0-9
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/typesense-instantsearch-adapter.js +13 -9
- 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 +13 -9
- package/lib/Configuration.js.map +1 -1
- package/package.json +2 -2
- package/src/Configuration.js +12 -5
|
@@ -2211,6 +2211,8 @@ var Configuration = /*#__PURE__*/function () {
|
|
|
2211
2211
|
_this$additionalSearc2,
|
|
2212
2212
|
_ref3,
|
|
2213
2213
|
_this$additionalSearc3,
|
|
2214
|
+
_ref4,
|
|
2215
|
+
_this$additionalSearc4,
|
|
2214
2216
|
_options$geoLocationF,
|
|
2215
2217
|
_options$collectionSp,
|
|
2216
2218
|
_this = this;
|
|
@@ -2230,17 +2232,19 @@ var Configuration = /*#__PURE__*/function () {
|
|
|
2230
2232
|
this.server.cacheSearchResultsForSeconds = (_this$server$cacheSea = this.server.cacheSearchResultsForSeconds) !== null && _this$server$cacheSea !== void 0 ? _this$server$cacheSea : 2 * 60;
|
|
2231
2233
|
this.additionalSearchParameters = (_options$additionalSe = options.additionalSearchParameters) !== null && _options$additionalSe !== void 0 ? _options$additionalSe : {};
|
|
2232
2234
|
this.additionalSearchParameters.query_by = (_ref = (_this$additionalSearc = this.additionalSearchParameters.queryBy) !== null && _this$additionalSearc !== void 0 ? _this$additionalSearc : this.additionalSearchParameters.query_by) !== null && _ref !== void 0 ? _ref : "";
|
|
2233
|
-
this.additionalSearchParameters.
|
|
2234
|
-
this.additionalSearchParameters.
|
|
2235
|
+
this.additionalSearchParameters.preset = (_ref2 = (_this$additionalSearc2 = this.additionalSearchParameters.preset) !== null && _this$additionalSearc2 !== void 0 ? _this$additionalSearc2 : this.additionalSearchParameters.preset) !== null && _ref2 !== void 0 ? _ref2 : "";
|
|
2236
|
+
this.additionalSearchParameters.sort_by = (_ref3 = (_this$additionalSearc3 = this.additionalSearchParameters.sortBy) !== null && _this$additionalSearc3 !== void 0 ? _this$additionalSearc3 : this.additionalSearchParameters.sort_by) !== null && _ref3 !== void 0 ? _ref3 : "";
|
|
2237
|
+
this.additionalSearchParameters.highlight_full_fields = (_ref4 = (_this$additionalSearc4 = this.additionalSearchParameters.highlightFullFields) !== null && _this$additionalSearc4 !== void 0 ? _this$additionalSearc4 : this.additionalSearchParameters.highlight_full_fields) !== null && _ref4 !== void 0 ? _ref4 : this.additionalSearchParameters.query_by;
|
|
2235
2238
|
this.geoLocationField = (_options$geoLocationF = options.geoLocationField) !== null && _options$geoLocationF !== void 0 ? _options$geoLocationF : "_geoloc";
|
|
2236
2239
|
this.collectionSpecificSearchParameters = (_options$collectionSp = options.collectionSpecificSearchParameters) !== null && _options$collectionSp !== void 0 ? _options$collectionSp : {};
|
|
2237
2240
|
Object.keys(this.collectionSpecificSearchParameters).forEach(function (collection) {
|
|
2238
|
-
var _params$queryBy, _params$
|
|
2241
|
+
var _params$queryBy, _params$preset, _params$sortBy, _ref5, _ref6, _params$highlightFull;
|
|
2239
2242
|
|
|
2240
2243
|
var params = _this.collectionSpecificSearchParameters[collection];
|
|
2241
2244
|
params.query_by = (_params$queryBy = params.queryBy) !== null && _params$queryBy !== void 0 ? _params$queryBy : params.query_by;
|
|
2245
|
+
params.preset = (_params$preset = params.preset) !== null && _params$preset !== void 0 ? _params$preset : params.preset;
|
|
2242
2246
|
params.sort_by = (_params$sortBy = params.sortBy) !== null && _params$sortBy !== void 0 ? _params$sortBy : params.sort_by;
|
|
2243
|
-
params.highlight_full_fields = (
|
|
2247
|
+
params.highlight_full_fields = (_ref5 = (_ref6 = (_params$highlightFull = params.highlightFullFields) !== null && _params$highlightFull !== void 0 ? _params$highlightFull : params.highlight_full_fields) !== null && _ref6 !== void 0 ? _ref6 : _this.additionalSearchParameters.highlight_full_fields) !== null && _ref5 !== void 0 ? _ref5 : params.query_by; // Remove undefined values
|
|
2244
2248
|
|
|
2245
2249
|
Object.keys(params).forEach(function (key) {
|
|
2246
2250
|
return params[key] === undefined ? delete params[key] : {};
|
|
@@ -2258,16 +2262,16 @@ var Configuration = /*#__PURE__*/function () {
|
|
|
2258
2262
|
console.warn("[typesense-instantsearch-adapter] Please use snake_cased versions of parameters in additionalSearchParameters instead of camelCased parameters. For example: Use query_by instead of queryBy. camelCased parameters will be deprecated in a future version." + " We're making this change so that parameter names are identical to the ones sent to Typesense (which are all snake_cased), and to also keep the types for these parameters in sync with the types defined in typesense-js.");
|
|
2259
2263
|
}
|
|
2260
2264
|
/*
|
|
2261
|
-
* Either additionalSearchParameters.query_by needs to be set, or
|
|
2262
|
-
* All collectionSpecificSearchParameters need to have query_by
|
|
2265
|
+
* Either additionalSearchParameters.query_by or additionalSearchParameters.preset needs to be set, or
|
|
2266
|
+
* All collectionSpecificSearchParameters need to have query_by or preset
|
|
2263
2267
|
*
|
|
2264
2268
|
* */
|
|
2265
2269
|
|
|
2266
2270
|
|
|
2267
|
-
if (this.additionalSearchParameters.query_by.length === 0 && (Object.keys(this.collectionSpecificSearchParameters).length === 0 || Object.values(this.collectionSpecificSearchParameters).some(function (c) {
|
|
2268
|
-
return (c.query_by || "").length === 0;
|
|
2271
|
+
if (this.additionalSearchParameters.query_by.length === 0 && this.additionalSearchParameters.preset.length === 0 && (Object.keys(this.collectionSpecificSearchParameters).length === 0 || Object.values(this.collectionSpecificSearchParameters).some(function (c) {
|
|
2272
|
+
return (c.query_by || "").length === 0 && (c.preset || "").length === 0;
|
|
2269
2273
|
}))) {
|
|
2270
|
-
throw new Error("[typesense-instantsearch-adapter] Missing parameter:
|
|
2274
|
+
throw new Error("[typesense-instantsearch-adapter] Missing parameter: One of additionalSearchParameters.query_by or additionalSearchParameters.preset needs to be set, or all collectionSpecificSearchParameters need to have either .query_by or .preset set.");
|
|
2271
2275
|
}
|
|
2272
2276
|
}
|
|
2273
2277
|
}]);
|