Skip to content

Commit

Permalink
WIP on #64.
Browse files Browse the repository at this point in the history
  • Loading branch information
mjordan committed Nov 29, 2020
1 parent dfef3cc commit 0312bd3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/**
* @file
* Install file for theislandora_repository_reports_oai_usage modlue.
* Install file for the islandora_repository_reports_oai_usage module.
*/

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,6 @@ function _islandora_repository_reports_searches_form_islandora_repository_report
* Implements hook_search_api_results_alter().
*/
function islandora_repository_reports_searches_search_api_results_alter(ResultSetInterface &$results) {
$current_uri = \Drupal::request()->getRequestUri();

$items = $results->getResultItems();
$num_results = count($items); // <- This is not the total number of results, it's the number in the current page of results.

$ip_address = \Drupal::request()->getClientIp();
// Get client's hostname when there is one, otherwise use IP address.
$hostname = gethostbyaddr($ip_address);
Expand All @@ -75,8 +70,8 @@ function islandora_repository_reports_searches_search_api_results_alter(ResultSe
'ip_address' => $ip_address,
'hostname' => $hostname,
'created' => \Drupal::time()->getRequestTime(),
'search_request' => $current_uri,
'hits' => $num_results,
'search_request' => \Drupal::request()->getRequestUri(),
'hits' => $results->getResultCount(),
])
->execute();
}
Expand Down

0 comments on commit 0312bd3

Please sign in to comment.