typesense-instantsearch-adapter 2.5.0-0 → 2.5.0-2
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 +12 -7
- 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/index.d.ts +1 -0
- package/lib/Configuration.js +1 -0
- package/lib/Configuration.js.map +1 -1
- package/lib/SearchResponseAdapter.js +11 -7
- package/lib/SearchResponseAdapter.js.map +1 -1
- package/package.json +1 -1
- package/src/Configuration.js +2 -0
- package/src/SearchResponseAdapter.js +11 -7
|
@@ -2228,6 +2228,7 @@ var Configuration = /*#__PURE__*/function () {
|
|
|
2228
2228
|
}]
|
|
2229
2229
|
};
|
|
2230
2230
|
this.server.cacheSearchResultsForSeconds = (_this$server$cacheSea = this.server.cacheSearchResultsForSeconds) !== null && _this$server$cacheSea !== void 0 ? _this$server$cacheSea : 2 * 60;
|
|
2231
|
+
this.useHighlightV2Structure = this.options.useHighlightV2Structure || true;
|
|
2231
2232
|
this.additionalSearchParameters = (_options$additionalSe = options.additionalSearchParameters) !== null && _options$additionalSe !== void 0 ? _options$additionalSe : {};
|
|
2232
2233
|
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
2234
|
this.additionalSearchParameters.sort_by = (_ref2 = (_this$additionalSearc2 = this.additionalSearchParameters.sortBy) !== null && _this$additionalSearc2 !== void 0 ? _this$additionalSearc2 : this.additionalSearchParameters.sort_by) !== null && _ref2 !== void 0 ? _ref2 : "";
|
|
@@ -2856,7 +2857,7 @@ var SearchResponseAdapter = /*#__PURE__*/function () {
|
|
|
2856
2857
|
var result = {}; // If there is a highlight object available (as of v0.24.0),
|
|
2857
2858
|
// use that instead of the highlights array, since it supports highlights of nested fields
|
|
2858
2859
|
|
|
2859
|
-
if (typesenseHit.highlight != null) {
|
|
2860
|
+
if (this.configuration.useHighlightV2Structure && typesenseHit.highlight != null) {
|
|
2860
2861
|
this.adaptHighlightObject(typesenseHit, result, snippetOrValue);
|
|
2861
2862
|
} else {
|
|
2862
2863
|
this.adaptHighlightsArray(typesenseHit, result, snippetOrValue);
|
|
@@ -2951,13 +2952,13 @@ var SearchResponseAdapter = /*#__PURE__*/function () {
|
|
|
2951
2952
|
if (Array.isArray(value)) {
|
|
2952
2953
|
var _highlightObjectValue;
|
|
2953
2954
|
|
|
2954
|
-
adaptedValue = _this4._adaptHighlightInArrayValue(value, (_highlightObjectValue = highlightObjectValue[attribute]) !== null && _highlightObjectValue !== void 0 ? _highlightObjectValue :
|
|
2955
|
+
adaptedValue = _this4._adaptHighlightInArrayValue(value, (_highlightObjectValue = highlightObjectValue === null || highlightObjectValue === void 0 ? void 0 : highlightObjectValue[attribute]) !== null && _highlightObjectValue !== void 0 ? _highlightObjectValue : [], snippetOrValue);
|
|
2955
2956
|
} else if ((0,_babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__["default"])(value) === "object") {
|
|
2956
2957
|
var _highlightObjectValue2;
|
|
2957
2958
|
|
|
2958
|
-
adaptedValue = _this4._adaptHighlightInObjectValue(value, (_highlightObjectValue2 = highlightObjectValue[attribute]) !== null && _highlightObjectValue2 !== void 0 ? _highlightObjectValue2 : {}, snippetOrValue);
|
|
2959
|
+
adaptedValue = _this4._adaptHighlightInObjectValue(value, (_highlightObjectValue2 = highlightObjectValue === null || highlightObjectValue === void 0 ? void 0 : highlightObjectValue[attribute]) !== null && _highlightObjectValue2 !== void 0 ? _highlightObjectValue2 : {}, snippetOrValue);
|
|
2959
2960
|
} else {
|
|
2960
|
-
adaptedValue = _this4._adaptHighlightInPrimitiveValue(value, highlightObjectValue[attribute], snippetOrValue);
|
|
2961
|
+
adaptedValue = _this4._adaptHighlightInPrimitiveValue(value, highlightObjectValue === null || highlightObjectValue === void 0 ? void 0 : highlightObjectValue[attribute], snippetOrValue);
|
|
2961
2962
|
}
|
|
2962
2963
|
|
|
2963
2964
|
return (0,_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_3__["default"])({}, attribute, adaptedValue);
|
|
@@ -2972,11 +2973,15 @@ var SearchResponseAdapter = /*#__PURE__*/function () {
|
|
|
2972
2973
|
var adaptedValue;
|
|
2973
2974
|
|
|
2974
2975
|
if (Array.isArray(value)) {
|
|
2975
|
-
|
|
2976
|
+
var _highlightArrayValue$;
|
|
2977
|
+
|
|
2978
|
+
adaptedValue = _this5._adaptHighlightInArrayValue(value, (_highlightArrayValue$ = highlightArrayValue === null || highlightArrayValue === void 0 ? void 0 : highlightArrayValue[index]) !== null && _highlightArrayValue$ !== void 0 ? _highlightArrayValue$ : [], snippetOrValue);
|
|
2976
2979
|
} else if ((0,_babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__["default"])(value) === "object") {
|
|
2977
|
-
|
|
2980
|
+
var _highlightArrayValue$2;
|
|
2981
|
+
|
|
2982
|
+
adaptedValue = _this5._adaptHighlightInObjectValue(value, (_highlightArrayValue$2 = highlightArrayValue === null || highlightArrayValue === void 0 ? void 0 : highlightArrayValue[index]) !== null && _highlightArrayValue$2 !== void 0 ? _highlightArrayValue$2 : {}, snippetOrValue);
|
|
2978
2983
|
} else {
|
|
2979
|
-
adaptedValue = _this5._adaptHighlightInPrimitiveValue(value, highlightArrayValue[index], snippetOrValue);
|
|
2984
|
+
adaptedValue = _this5._adaptHighlightInPrimitiveValue(value, highlightArrayValue === null || highlightArrayValue === void 0 ? void 0 : highlightArrayValue[index], snippetOrValue);
|
|
2980
2985
|
}
|
|
2981
2986
|
|
|
2982
2987
|
return adaptedValue;
|