Source:
<code>public void receiveEvent(Event event) { if (event instanceof UsageEvent) { log.debug("Usage event received " + event.getName()); try { UsageEvent ue = (UsageEvent) event; EPerson currentUser = ue.getContext() == null ? null : ue.getContext().getCurrentUser(); if (UsageEvent.Action.VIEW == ue.getAction()) { if (ue.getRequest() != null) { solrLoggerService.postView(ue.getObject(), ue.getRequest(), currentUser); } else { solrLoggerService.postView(ue.getObject(), ue.getIp(), ue.getUserAgent(), ue.getXforwardedfor(), currentUser); } } else if (UsageEvent.Action.SEARCH == ue.getAction()) { <START> if (ue instanceof UsageSearchEvent) { <END> UsageSearchEvent usageSearchEvent = (UsageSearchEvent) ue; if (!CollectionUtils.isEmpty(((UsageSearchEvent) ue).getQueries())) { solrLoggerService.postSearch(ue.getObject(), ue.getRequest(), currentUser, usageSearchEvent.getQueries(), usageSearchEvent.getRpp(), usageSearchEvent.getSortBy(), usageSearchEvent.getSortOrder(), usageSearchEvent.getPage(), usageSearchEvent.getScope()); } } else { RestUsageSearchEvent restUsageSearchEvent = (RestUsageSearchEvent) ue; List<String> queries = new LinkedList<>(); queries.add(restUsageSearchEvent.getQuery()); solrLoggerService .postSearch(restUsageSearchEvent.getObject(), restUsageSearchEvent.getRequest(), currentUser, queries, restUsageSearchEvent.getPage().getSize(), restUsageSearchEvent.getSort().getBy(), restUsageSearchEvent.getSort().getOrder(), restUsageSearchEvent.getPage().getNumber(), restUsageSearchEvent.getScope()); } } else if (UsageEvent.Action.WORKFLOW == ue.getAction()) { UsageWorkflowEvent usageWorkflowEvent = (UsageWorkflowEvent) ue; solrLoggerService.postWorkflow(usageWorkflowEvent); } } catch (Exception e) { log.error("Error processing/logging UsageEvent {}", event.getName(), e); } } }</code><technical_language>This instanceof implementation UsageSearchEvent multiple queries (which is weird). I recommend UsageSearchEvent instead, remove instanceof fix UsageSearchEvent a single query</technical_language>

Target:
public void receiveEvent(Event event) { if (event instanceof UsageEvent) { log.debug("Usage event received " + event.getName()); try { UsageEvent ue = (UsageEvent) event; EPerson currentUser = ue.getContext() == null ? null : ue.getContext().getCurrentUser(); if (UsageEvent.Action.VIEW == ue.getAction()) { if (ue.getRequest() != null) { solrLoggerService.postView(ue.getObject(), ue.getRequest(), currentUser); } else { solrLoggerService.postView(ue.getObject(), ue.getIp(), ue.getUserAgent(), ue.getXforwardedfor(), currentUser); } } else if (UsageEvent.Action.SEARCH == ue.getAction()) { UsageSearchEvent usageSearchEvent = (UsageSearchEvent) ue; List<String> queries = new LinkedList<>(); queries.add(usageSearchEvent.getQuery()); solrLoggerService.postSearch(usageSearchEvent.getObject(), usageSearchEvent.getRequest(), currentUser, queries, usageSearchEvent.getPage().getSize(), usageSearchEvent.getSort().getBy(), usageSearchEvent.getSort().getOrder(), usageSearchEvent.getPage().getNumber(), usageSearchEvent.getScope()); } else if (UsageEvent.Action.WORKFLOW == ue.getAction()) { UsageWorkflowEvent usageWorkflowEvent = (UsageWorkflowEvent) ue; solrLoggerService.postWorkflow(usageWorkflowEvent); } } catch (Exception e) { log.error("Error processing/logging UsageEvent {}", event.getName(), e); } } }