Minor fixes

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/social-networking/social-data-indexer-se-plugin@124219 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Costantino Perciante 2016-02-16 13:59:48 +00:00
parent 7e645cec61
commit 385eaa9614
1 changed files with 16 additions and 5 deletions

View File

@ -98,10 +98,14 @@ public class SocialDataIndexerPlugin extends Plugin<SocialDataIndexerPluginDecla
ElasticSearchRunningCluster elasticCluster;
try {
elasticCluster = new ElasticSearchRunningCluster(scope);
} catch (Exception e1) {
logger.error(e1.toString());
return;
}
// save info
@ -118,7 +122,7 @@ public class SocialDataIndexerPlugin extends Plugin<SocialDataIndexerPluginDecla
// Look at https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/transport-client.html
Settings settings = Settings.settingsBuilder()
.put("cluster.name", this.clusterName) // force unique cluster's name check
//.put("client.transport.sniff", true) -> unneeded since we pass all the cluster's nodes
.put("client.transport.sniff", true)
.build();
// build the client
@ -136,7 +140,6 @@ public class SocialDataIndexerPlugin extends Plugin<SocialDataIndexerPluginDecla
} catch (UnknownHostException e) {
logger.error("Error while adding " + hostsToContact.get(i) + ":" + portNumbers.get(i) + " as host to be contacted.");
return;
}
}
@ -152,8 +155,10 @@ public class SocialDataIndexerPlugin extends Plugin<SocialDataIndexerPluginDecla
vreIds = store.getAllVREIds();
} catch (ConnectionException e) {
logger.error("Unable to retrieve vres' ids", e);
return;
}
// save feeds & comments
@ -173,8 +178,8 @@ public class SocialDataIndexerPlugin extends Plugin<SocialDataIndexerPluginDecla
}catch(Exception e){
logger.debug("Exception while saving feeds/comments into the index", e);
return;
logger.debug("Exception while saving feeds/comments into the index for vre " + vreID, e);
continue;
}
}
@ -300,7 +305,7 @@ public class SocialDataIndexerPlugin extends Plugin<SocialDataIndexerPluginDecla
for (Feed feed : toEnhance) {
// skip disabled feeds but delete from the index
// skip disabled feeds but delete from the index (they could be present)
if(feed.getType().equals(FeedType.DISABLED)){
deleteDocument(feed.getKey());
@ -313,12 +318,18 @@ public class SocialDataIndexerPlugin extends Plugin<SocialDataIndexerPluginDecla
// retrieve attachments
ArrayList<Attachment> attachments = new ArrayList<Attachment>();
if (isMultiFileUpload) {
logger.debug("Retrieving attachments for feed with id="+feed.getKey());
try {
attachments = (ArrayList<Attachment>) store.getAttachmentsByFeedId(feed.getKey());
} catch (FeedIDNotFoundException e) {
logger.error("It looks like sth wrong with this feedid having attachments, could not find feedId = " + feed.getKey() + "\n" + e.getMessage());
continue;
}
}