When retrieving docs, if one is disabled force deletion

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/social-networking/social-data-search-client@124190 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Costantino Perciante 2016-02-15 13:19:49 +00:00
parent 8fa1234941
commit dca2d4b901
1 changed files with 5 additions and 1 deletions

View File

@ -162,6 +162,8 @@ public class ElasticSearchClientImpl implements ElasticSearchClientInterface{
// check if it is still valid and add
if(!enhFeed.getFeed().getType().equals(FeedType.DISABLED))
toReturn.add(enhFeed);
else
deleteDocument(enhFeed.getFeed().getKey());
} catch (IOException e) {
_log.error(e.toString());
@ -175,8 +177,10 @@ public class ElasticSearchClientImpl implements ElasticSearchClientInterface{
@Override
public boolean deleteDocument(String docID) {
if(docID == null)
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();