@eeacms/volto-globalsearch 1.0.18 → 1.0.19

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 CHANGED
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file. Dates are d
4
4
 
5
5
  Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
6
6
 
7
+ ### [1.0.19](https://github.com/eea/volto-globalsearch/compare/1.0.18...1.0.19) - 25 July 2023
8
+
9
+ #### :hammer_and_wrench: Others
10
+
11
+ - extended healthcheck with info about the index & elapsed time for queries on nlp [Zoltan Szabo - [`f7fb5ae`](https://github.com/eea/volto-globalsearch/commit/f7fb5ae0afae1f3f57b4ae96547c42bd5bccaa10)]
7
12
  ### [1.0.18](https://github.com/eea/volto-globalsearch/compare/1.0.17...1.0.18) - 10 July 2023
8
13
 
9
14
  #### :hammer_and_wrench: Others
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-globalsearch",
3
- "version": "1.0.18",
3
+ "version": "1.0.19",
4
4
  "description": "@eeacms/volto-globalsearch: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -1,23 +1,33 @@
1
1
  import runRequest from '@eeacms/search/lib/runRequest';
2
2
  import buildRequest from '@eeacms/search/lib/search/query';
3
+ import getInfo from '@eeacms/search/lib/getIndexInfo';
3
4
 
4
- export default function healthcheck(appConfig) {
5
+ export default async function healthcheck(appConfig) {
5
6
  // is index ok?
6
7
  // return index update date
7
8
  // run default query, see number of results
8
9
  // nlpservice provides answer based on extracted term
9
10
  // number of documents with error in data raw, type of error
10
11
 
11
- return new Promise((resolve, reject) => {
12
- const body = buildRequest({ filters: [] }, appConfig);
13
- runRequest(body, appConfig).then((resp) => {
14
- let total;
15
- try {
16
- total = resp.body.hits.total.value;
17
- resolve({ documentCount: total });
18
- } catch {
19
- reject({ total: -1 });
20
- }
21
- });
12
+ return new Promise(async (resolve, reject) => {
13
+ try {
14
+ const body_total = buildRequest({ filters: [] }, appConfig);
15
+
16
+ const resp_total = await runRequest(body_total, appConfig);
17
+ const total = resp_total.body.hits.total.value;
18
+
19
+ const body_nlp = buildRequest(
20
+ { filters: [], searchTerm: 'what is bise?' },
21
+ appConfig,
22
+ );
23
+ const resp_nlp = await runRequest(body_nlp, appConfig);
24
+ const elapsed = resp_nlp.body.elapsed;
25
+
26
+ const info = await getInfo(appConfig);
27
+
28
+ resolve({ documentCount: total, elapsed: elapsed, index_info: info });
29
+ } catch {
30
+ reject({ total: -1 });
31
+ }
22
32
  });
23
33
  }