Feeds retrieved from the index cannot be disabled, so the deleteDoc() is no longer invoked from the query function

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/social-networking/social-data-search-client@124215 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Costantino Perciante 2016-02-16 13:56:24 +00:00
parent dca2d4b901
commit 2c9e07e5a9
1 changed files with 3 additions and 9 deletions

View File

@ -20,7 +20,6 @@ import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.index.query.TermsQueryBuilder;
import org.elasticsearch.search.SearchHit;
import org.gcube.portal.databook.shared.EnhancedFeed;
import org.gcube.portal.databook.shared.FeedType;
import org.gcube.socialnetworking.social_data_indexing_common.utils.ElasticSearchRunningCluster;
import org.gcube.socialnetworking.social_data_indexing_common.utils.IndexFields;
import org.slf4j.Logger;
@ -158,18 +157,13 @@ public class ElasticSearchClientImpl implements ElasticSearchClientInterface{
try {
enhFeed = mapper.readValue(hit.getSourceAsString(), EnhancedFeed.class);
// check if it is still valid and add
if(!enhFeed.getFeed().getType().equals(FeedType.DISABLED))
toReturn.add(enhFeed);
else
deleteDocument(enhFeed.getFeed().getKey());
toReturn.add(enhFeed);
} catch (IOException e) {
_log.error(e.toString());
}
}
_log.debug("Returning " + toReturn.size() + " results");
return toReturn;
}
@ -179,7 +173,7 @@ public class ElasticSearchClientImpl implements ElasticSearchClientInterface{
if(docID == null || docID.isEmpty())
return false;
_log.debug("Removing doc with id " + docID);
DeleteResponse response = client.prepareDelete(IndexFields.INDEX_NAME, IndexFields.EF_FEEDS_TABLE, docID).get();