Commit 34f4c265 authored by Jonas Waeber's avatar Jonas Waeber

Update docs for ESWrapper

parent dcff102c
......@@ -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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment