From 3b683e13686eaa0d6eb756b75d62cb8835e269d9 Mon Sep 17 00:00:00 2001 From: Daniel Goerz <dlg@lightwerk.com> Date: Tue, 4 Jul 2017 14:07:24 +0200 Subject: [PATCH] [BUGFIX] EXT:indexed_search: Dont add stat record for empty search Resolves: #81786 Releases: master, 8.7 Change-Id: I1bc5e93fdfb3a1068a09ae37c47e51b1811d58b5 Reviewed-on: https://review.typo3.org/53396 Tested-by: TYPO3com <no-reply@typo3.com> Reviewed-by: Sascha Rademacher <s.rademacher@neusta.de> Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch> Tested-by: Christian Kuhn <lolli@schwarzbu.ch> Reviewed-by: Susanne Moog <susanne.moog@typo3.org> Tested-by: Susanne Moog <susanne.moog@typo3.org> --- .../Classes/Controller/SearchController.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/typo3/sysext/indexed_search/Classes/Controller/SearchController.php b/typo3/sysext/indexed_search/Classes/Controller/SearchController.php index 1a07d46e1551..04952bd52cd3 100644 --- a/typo3/sysext/indexed_search/Classes/Controller/SearchController.php +++ b/typo3/sysext/indexed_search/Classes/Controller/SearchController.php @@ -793,7 +793,7 @@ class SearchController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControlle } /** - * Write statistics information to database for the search operation + * Write statistics information to database for the search operation if there was at least one search word. * * @param array $searchParams search params * @param array $searchWords Search Word array @@ -802,8 +802,13 @@ class SearchController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControlle */ protected function writeSearchStat($searchParams, $searchWords, $count, $pt) { + $searchWord = $this->getSword(); + if (empty($searchWord) && empty($searchWords)) { + return; + } + $insertFields = [ - 'searchstring' => $this->getSword(), + 'searchstring' => $searchWord, 'searchoptions' => serialize([$searchParams, $searchWords, $pt]), 'feuser_id' => (int)$GLOBALS['TSFE']->fe_user->user['uid'], // cookie as set or retrieved. If people has cookies disabled this will vary all the time -- GitLab