All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.biacode.escommons.toolkit.component.SearchResponseComponent.kt Maven / Gradle / Ivy

There is a newer version: 7.3.2_0.1.0
Show newest version
package org.biacode.escommons.toolkit.component

import org.biacode.escommons.core.model.document.AbstractEsDocument
import org.biacode.escommons.core.model.response.DocumentsAndTotalCount
import org.elasticsearch.action.get.GetResponse
import org.elasticsearch.action.search.SearchResponse

/**
 * Created by Arthur Asatryan.
 * Date: 7/10/17
 * Time: 6:11 PM
 */
interface SearchResponseComponent {
    /**
     * Converts search response to documents and total count.
     *
     * @param             the type parameter
     * @param searchResponse the search response
     * @param clazz          the clazz
     * @return the documents and total count
     */
    fun  documentsAndTotalCount(searchResponse: SearchResponse, clazz: Class): DocumentsAndTotalCount

    /**
     * Converts get response to documents and total count
     *
     * @param          the type parameter
     * @param getResponse the get response
     * @param clazz       the clazz
     * @return the documents and total count
     */
    fun  document(getResponse: GetResponse, clazz: Class): T

    /**
     * Convert search response to documents list.
     *
     * @param          the type parameter
     * @param getResponse the get response
     * @param clazz       the clazz
     * @return the documents list
     */
    fun  documents(getResponse: SearchResponse, clazz: Class): List

    /**
     * Extracts _id fields from given search response
     *
     * @param searchResponse the search response
     * @return list of ids
     */
    fun ids(searchResponse: SearchResponse): List
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy