social-data-search-client/src/main/java/org/gcube/socialnetworking/social_data_search_client/ElasticSearchClient.java

47 lines
1.9 KiB
Java

package org.gcube.socialnetworking.social_data_search_client;
import java.util.List;
import java.util.Set;
import org.gcube.social_networking.socialnetworking.model.shared.EnhancedPost;
import org.gcube.socialnetworking.social_data_indexing_common.utils.SearchableFields;
/**
* The ElasticSearchClient client interface to search in social data.
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
*/
public interface ElasticSearchClient {
/**
* Given a query, the method find matching enhanced post into the elasticsearch index and return
* at most <b>quantity</b> hits starting from <b>from</b>. A multimatch query is performed against all
* searchable fields.
* @param query the query to match
* @param vreIDS specifies the vre(s) to which the returning posts must belong
* @param from start hits index
* @param quantity max number of hits to return starting from <b>from</b>
* @return A list of matching enhanced posts or nothing
*/
List<EnhancedPost> search(String query, Set<String> vreIDS, int from, int quantity);
/**
* Given a query, the method find matching enhanced posts into the elasticsearch index and return
* at most <b>quantity</b> hits starting from <b>from</b>. The query is performed against one of the searchable fields.
* @param query the query to match
* @param vreIDS specifies the vre(s) to which the returning posts must belong
* @param from start hits index
* @param quantity max number of hits to return starting from <b>from</b>
* @param field the field against which the query is performed
* @return A list of matching enhanced posts or nothing
*/
List<EnhancedPost> searchInField(String query, Set<String> vreIDS, int from, int quantity, SearchableFields field);
/**
* Delete from the index a document with id docID.
* @param docID the id of the doc to delete
* @return true on success, false otherwise
*/
boolean deleteDocument(String docID);
}