@usereactify/search 4.4.2 → 4.4.3
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/CHANGELOG.md +7 -0
- package/dist/package.json +1 -1
- package/dist/src/sensor/SensorCollection.js +42 -27
- package/dist/src/sensor/SensorSearch.js +15 -8
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [4.4.3](https://bitbucket.org/usereactify/reactify-search-ui/compare/v4.4.2...v4.4.3) (2022-08-03)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* only query for curations when a curation is active ([6ff04df](https://bitbucket.org/usereactify/reactify-search-ui/commit/6ff04df4c88bc3d2c0c205fb31b8b7899785a815))
|
|
11
|
+
|
|
5
12
|
### [4.4.2](https://bitbucket.org/usereactify/reactify-search-ui/compare/v4.4.1...v4.4.2) (2022-08-01)
|
|
6
13
|
|
|
7
14
|
### [4.4.1](https://bitbucket.org/usereactify/reactify-search-ui/compare/v4.4.0...v4.4.1) (2022-07-21)
|
package/dist/package.json
CHANGED
|
@@ -6,36 +6,51 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.SensorCollection = void 0;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const ReactiveComponent_1 = __importDefault(require("@appbaseio/reactivesearch/lib/components/basic/ReactiveComponent"));
|
|
9
|
-
const
|
|
9
|
+
const provider_1 = require("../provider");
|
|
10
10
|
const SensorCollection = () => {
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
var _a;
|
|
12
|
+
const context = (0, provider_1.useContext)();
|
|
13
|
+
if (!((_a = context.collection) === null || _a === void 0 ? void 0 : _a.handle)) {
|
|
13
14
|
return null;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
15
|
+
}
|
|
16
|
+
return (react_1.default.createElement(ReactiveComponent_1.default, { componentId: "SensorCollection", customQuery: () => {
|
|
17
|
+
var _a, _b;
|
|
18
|
+
return ({
|
|
19
|
+
query: {
|
|
20
|
+
bool: {
|
|
21
|
+
should: [
|
|
22
|
+
...(((_a = context.collection) === null || _a === void 0 ? void 0 : _a.handle)
|
|
23
|
+
? [
|
|
24
|
+
{
|
|
25
|
+
nested: {
|
|
26
|
+
path: "collections",
|
|
27
|
+
query: {
|
|
28
|
+
term: {
|
|
29
|
+
"collections.handle.keyword": context.collection.handle,
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
},
|
|
32
33
|
},
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
]
|
|
35
|
+
: []),
|
|
36
|
+
...(((_b = context.curation) === null || _b === void 0 ? void 0 : _b.id)
|
|
37
|
+
? [
|
|
38
|
+
{
|
|
39
|
+
nested: {
|
|
40
|
+
path: "curations",
|
|
41
|
+
query: {
|
|
42
|
+
term: {
|
|
43
|
+
"curations.collectionHandle.keyword": context.curation.collectionHandle,
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
]
|
|
49
|
+
: []),
|
|
50
|
+
],
|
|
51
|
+
},
|
|
37
52
|
},
|
|
38
|
-
}
|
|
39
|
-
}
|
|
53
|
+
});
|
|
54
|
+
} }));
|
|
40
55
|
};
|
|
41
56
|
exports.SensorCollection = SensorCollection;
|
|
@@ -7,7 +7,9 @@ exports.SensorSearch = void 0;
|
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const DataSearch_1 = __importDefault(require("@appbaseio/reactivesearch/lib/components/search/DataSearch"));
|
|
9
9
|
const hooks_1 = require("../hooks");
|
|
10
|
+
const provider_1 = require("../provider");
|
|
10
11
|
const SensorSearch = () => {
|
|
12
|
+
const context = (0, provider_1.useContext)();
|
|
11
13
|
const { fields } = (0, hooks_1.useConfig)();
|
|
12
14
|
const { searchQuery } = (0, hooks_1.useSearch)();
|
|
13
15
|
// ignore search fields only set for instant search
|
|
@@ -17,6 +19,7 @@ const SensorSearch = () => {
|
|
|
17
19
|
}
|
|
18
20
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
19
21
|
react_1.default.createElement(DataSearch_1.default, { fuzziness: 1, queryFormat: "and", autosuggest: false, value: searchQuery, componentId: "SensorSearch", style: { display: "none" }, dataField: searchFields.map((field) => field.field), fieldWeights: searchFields.map((field) => field.importance), customQuery: (value, props) => {
|
|
22
|
+
var _a;
|
|
20
23
|
const { dataField, fieldWeights } = props;
|
|
21
24
|
const fieldsCrossFields = dataField.map((field, index) => `${field}^${fieldWeights[index]}`);
|
|
22
25
|
const fieldsPhrase = dataField.map((field, index) => `${field}^${fieldWeights[index]}`);
|
|
@@ -26,16 +29,20 @@ const SensorSearch = () => {
|
|
|
26
29
|
const query = {
|
|
27
30
|
bool: {
|
|
28
31
|
should: [
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
...(((_a = context.curation) === null || _a === void 0 ? void 0 : _a.id)
|
|
33
|
+
? [
|
|
34
|
+
{
|
|
35
|
+
nested: {
|
|
36
|
+
path: "curations",
|
|
37
|
+
query: {
|
|
38
|
+
term: {
|
|
39
|
+
"curations.searchTerm.keyword": value === null || value === void 0 ? void 0 : value.toLowerCase(),
|
|
40
|
+
},
|
|
41
|
+
},
|
|
35
42
|
},
|
|
36
43
|
},
|
|
37
|
-
|
|
38
|
-
|
|
44
|
+
]
|
|
45
|
+
: []),
|
|
39
46
|
...(fieldsCrossFields.length > 0
|
|
40
47
|
? [
|
|
41
48
|
{
|