generated from eea/volto-addon-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b710a4f
commit 1860323
Showing
3 changed files
with
27 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import runRequest from '@eeacms/search/lib/runRequest'; | ||
import buildRequest from '@eeacms/search/lib/search/query'; | ||
|
||
export default function healthcheck(appConfig) { | ||
// is index ok? | ||
// return index update date | ||
// run default query, see number of results | ||
// nlpservice provides answer based on extracted term | ||
// number of documents with error in data raw, type of error | ||
|
||
return new Promise((resolve, reject) => { | ||
const body = buildRequest({ filters: [] }, appConfig); | ||
runRequest(body, appConfig).then((resp) => { | ||
let total; | ||
try { | ||
total = resp.body.hits.total.value; | ||
resolve({ documentCount: total }); | ||
} catch { | ||
reject({ total: -1 }); | ||
} | ||
}); | ||
}); | ||
} |