minor fixes before releasing 1.1
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/social-networking/social-data-search-client@132064 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
b0e7245ba7
commit
4eba3ca892
|
@ -35,7 +35,7 @@ import org.slf4j.LoggerFactory;
|
|||
public class ElasticSearchClientImpl implements ElasticSearchClientInterface{
|
||||
|
||||
//logger
|
||||
public static final Logger _log = LoggerFactory.getLogger(ElasticSearchClientImpl.class);
|
||||
public static final Logger logger = LoggerFactory.getLogger(ElasticSearchClientImpl.class);
|
||||
|
||||
// the elasticsearch client
|
||||
private TransportClient client;
|
||||
|
@ -64,7 +64,7 @@ public class ElasticSearchClientImpl implements ElasticSearchClientInterface{
|
|||
hostsToContact = elasticCluster.getHosts();
|
||||
portNumbers = elasticCluster.getPorts();
|
||||
|
||||
_log.debug("Creating elasticsearch client for hosts = " + hostsToContact + ", port = " + portNumbers + " and "
|
||||
logger.debug("Creating elasticsearch client for hosts = " + hostsToContact + ", port = " + portNumbers + " and "
|
||||
+ " cluster's name = " + clusterName);
|
||||
|
||||
|
||||
|
@ -91,13 +91,13 @@ public class ElasticSearchClientImpl implements ElasticSearchClientInterface{
|
|||
|
||||
} catch (UnknownHostException e) {
|
||||
|
||||
_log.debug("Error while adding " + hostsToContact.get(i) + ":" + portNumbers.get(i) + " as host to be contacted.");
|
||||
logger.debug("Error while adding " + hostsToContact.get(i) + ":" + portNumbers.get(i) + " as host to be contacted.");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
_log.debug("Connection to ElasticSearch cluster done.");
|
||||
logger.debug("Connection to ElasticSearch cluster done.");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -119,21 +119,21 @@ public class ElasticSearchClientImpl implements ElasticSearchClientInterface{
|
|||
IndexFields.EF_COMMENT_FULL_NAME)
|
||||
.type(Type.MOST_FIELDS);
|
||||
|
||||
// _log.debug(mq.toString());
|
||||
// logger.debug(mq.toString());
|
||||
|
||||
// filter on vre
|
||||
BoolQueryBuilder filter = QueryBuilders.boolQuery();
|
||||
TermsQueryBuilder queryFilter = QueryBuilders.termsQuery(IndexFields.EF_FEED_VRE_ID, vreIDS);
|
||||
filter.should(queryFilter);
|
||||
|
||||
//_log.debug(filter.toString());
|
||||
//logger.debug(filter.toString());
|
||||
|
||||
// final filtered query
|
||||
BoolQueryBuilder filteredQuery = QueryBuilders.boolQuery();
|
||||
filteredQuery.must(mq);
|
||||
filteredQuery.filter(filter);
|
||||
|
||||
//_log.debug(filteredQuery.toString());
|
||||
//logger.debug(filteredQuery.toString());
|
||||
|
||||
SearchResponse response = client.prepareSearch(IndexFields.INDEX_NAME)
|
||||
.setQuery(filteredQuery)
|
||||
|
@ -143,11 +143,11 @@ public class ElasticSearchClientImpl implements ElasticSearchClientInterface{
|
|||
.execute()
|
||||
.actionGet();
|
||||
|
||||
_log.debug("The search took " + response.getTookInMillis() + " ms");
|
||||
logger.debug("The search took " + response.getTookInMillis() + " ms");
|
||||
|
||||
SearchHit[] results = response.getHits().getHits();
|
||||
|
||||
_log.debug("Number of hits is " + results.length);
|
||||
logger.debug("Number of hits is " + results.length);
|
||||
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
|
||||
|
@ -160,11 +160,11 @@ public class ElasticSearchClientImpl implements ElasticSearchClientInterface{
|
|||
toReturn.add(enhFeed);
|
||||
|
||||
} catch (IOException e) {
|
||||
_log.error(e.toString());
|
||||
logger.error(e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
_log.debug("Returning " + toReturn.size() + " results");
|
||||
logger.debug("Returning " + toReturn.size() + " results");
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
|
@ -174,7 +174,7 @@ public class ElasticSearchClientImpl implements ElasticSearchClientInterface{
|
|||
if(docID == null || docID.isEmpty())
|
||||
return false;
|
||||
|
||||
_log.debug("Removing doc with id " + docID);
|
||||
logger.debug("Removing doc with id " + docID);
|
||||
|
||||
DeleteResponse response = client.prepareDelete(IndexFields.INDEX_NAME, IndexFields.EF_FEEDS_TABLE, docID).get();
|
||||
|
||||
|
@ -185,7 +185,7 @@ public class ElasticSearchClientImpl implements ElasticSearchClientInterface{
|
|||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
super.finalize();
|
||||
_log.info("Called finalize.. closing connection to elasticsearch");
|
||||
logger.info("Called finalize.. closing connection to elasticsearch");
|
||||
if(client != null)
|
||||
client.close();
|
||||
}
|
||||
|
|
|
@ -5,9 +5,6 @@ import java.util.HashSet;
|
|||
import java.util.Set;
|
||||
|
||||
import org.gcube.socialnetworking.social_data_indexing_common.utils.ElasticSearchRunningCluster;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
/**
|
||||
|
@ -19,9 +16,9 @@ public class Tests
|
|||
/**
|
||||
* Logger
|
||||
*/
|
||||
private static Logger _log = LoggerFactory.getLogger(Tests.class);
|
||||
private static Logger logger = LoggerFactory.getLogger(Tests.class);
|
||||
|
||||
@Before
|
||||
//@Before
|
||||
public void beforeTest(){
|
||||
}
|
||||
|
||||
|
@ -29,7 +26,7 @@ public class Tests
|
|||
public void retrieveElasticSearchInformation() throws Exception{
|
||||
|
||||
ElasticSearchRunningCluster es = new ElasticSearchRunningCluster("gcube");
|
||||
_log.debug("Result is " + es.getClusterName() + " " + es.getHosts() + " " + es.getPorts());
|
||||
logger.debug("Result is " + es.getClusterName() + " " + es.getHosts() + " " + es.getPorts());
|
||||
|
||||
}
|
||||
|
||||
|
@ -44,7 +41,7 @@ public class Tests
|
|||
|
||||
}
|
||||
|
||||
@After
|
||||
//@After
|
||||
public void after(){
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue