apply 6x commits

This commit is contained in:
Terry W Brady
2017-01-31 15:02:55 -08:00
parent 1af506d35f
commit 9e84117557

View File

@@ -181,6 +181,7 @@ public class SolrLoggerServiceImpl implements SolrLoggerService, InitializingBea
{ {
return; return;
} }
initSolrYearCores();
try try
@@ -215,38 +216,38 @@ public class SolrLoggerServiceImpl implements SolrLoggerService, InitializingBea
} }
@Override @Override
public void postView(DSpaceObject dspaceObject, public void postView(DSpaceObject dspaceObject,
String ip, String userAgent, String xforwardedfor, EPerson currentUser) { String ip, String userAgent, String xforwardedfor, EPerson currentUser) {
if (solr == null || locationService == null) { if (solr == null || locationService == null) {
return; return;
} }
initSolrYearCores();
try { try {
SolrInputDocument doc1 = getCommonSolrDoc(dspaceObject, ip, userAgent, xforwardedfor, SolrInputDocument doc1 = getCommonSolrDoc(dspaceObject, ip, userAgent, xforwardedfor,
currentUser); currentUser);
if (doc1 == null) if (doc1 == null)
return; return;
if (dspaceObject instanceof Bitstream) { if (dspaceObject instanceof Bitstream) {
Bitstream bit = (Bitstream) dspaceObject; Bitstream bit = (Bitstream) dspaceObject;
List<Bundle> bundles = bit.getBundles(); List<Bundle> bundles = bit.getBundles();
for (Bundle bundle : bundles) { for (Bundle bundle : bundles) {
doc1.addField("bundleName", bundle.getName()); doc1.addField("bundleName", bundle.getName());
} }
} }
doc1.addField("statistics_type", StatisticsType.VIEW.text()); doc1.addField("statistics_type", StatisticsType.VIEW.text());
solr.add(doc1); solr.add(doc1);
// commits are executed automatically using the solr autocommit // commits are executed automatically using the solr autocommit
// solr.commit(false, false); // solr.commit(false, false);
} catch (RuntimeException re) { } catch (RuntimeException re) {
throw re; throw re;
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
} }
} }
/** /**
* Returns a solr input document containing common information about the statistics * Returns a solr input document containing common information about the statistics
@@ -445,6 +446,7 @@ public class SolrLoggerServiceImpl implements SolrLoggerService, InitializingBea
{ {
SolrInputDocument solrDoc = getCommonSolrDoc(resultObject, request, currentUser); SolrInputDocument solrDoc = getCommonSolrDoc(resultObject, request, currentUser);
if (solrDoc == null) return; if (solrDoc == null) return;
initSolrYearCores();
for (String query : queries) { for (String query : queries) {
solrDoc.addField("query", query); solrDoc.addField("query", query);
@@ -491,6 +493,7 @@ public class SolrLoggerServiceImpl implements SolrLoggerService, InitializingBea
@Override @Override
public void postWorkflow(UsageWorkflowEvent usageWorkflowEvent) throws SQLException { public void postWorkflow(UsageWorkflowEvent usageWorkflowEvent) throws SQLException {
initSolrYearCores();
try { try {
SolrInputDocument solrDoc = getCommonSolrDoc(usageWorkflowEvent.getObject(), null, null); SolrInputDocument solrDoc = getCommonSolrDoc(usageWorkflowEvent.getObject(), null, null);