Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
memoriav
Memobase 2020
services
Elasticsearch Services
Search Doc Service
Commits
34f4c265
Commit
34f4c265
authored
Dec 08, 2020
by
Jonas Waeber
Browse files
Update docs for ESWrapper
parent
dcff102c
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/kotlin/helpers/ElasticSearchWrapper.kt
View file @
34f4c265
...
...
@@ -38,19 +38,8 @@ class ElasticSearchWrapper(settings: Properties) {
/**
* Establishes a connection to the client and ensures, that the index is present. The index may be an alias
* or an index directly.
*
* If the connection fails or the index does not exists, no client is created. When this happens all
* functions will be returning default values instead of executing the query.
*
* The service needs to be restarted to establish a new connection. It is reported within the logs that
* there is no successful connection.
*
* This makes it easier to test this service, and ensures that it keeps running even if elasticsearch is not
* available.
*
* TODO: In the future find a better solution.
*/
fun
connect
():
RestHighLevelClient
?
{
private
fun
connect
():
RestHighLevelClient
?
{
return
try
{
val
c
=
RestHighLevelClient
(
RestClient
.
builder
(
...
...
@@ -78,6 +67,10 @@ class ElasticSearchWrapper(settings: Properties) {
/**
* Counts the number of documents attached to a specific record set.
*
* @param recordSetIdentifier The memobase identifier of the record set.
*
* @return Number of Documents
*/
fun
countNumberOfDocuments
(
recordSetIdentifier
:
String
):
Int
{
if
(
client
==
null
)
...
...
@@ -108,7 +101,12 @@ class ElasticSearchWrapper(settings: Properties) {
}
/**
* Counts the number of documents attached to a specific record set.
* Collects all the document types present in the index for a specific record set.
*
* @param recordSetIdentifier: The memobase identifier of the record set.
* @param queryField: Name of the field the identifier is stored in.
*
* @return A list of unique document type facet containers.
*/
fun
getDocumentTypesFromRecords
(
recordSetIdentifier
:
String
,
queryField
:
String
):
List
<
FacetContainer
>
{
if
(
client
==
null
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment