Logging search phrases

Permalink
Hi,
i got a silly question and was not able to find any results via "search" because searching for search...
Ok,
i just want to know, if there is a possibility to log the search phrases (not from google) anybody entered in my concrete-search field?

Thanks for any ideas..

 
12345j replied on at Permalink Best Answer Reply
12345j
copy root/concrete/blocks/search to root/blocks/search and open controller.php . replace this-
$q = $_REQUEST['query'];
with
$q = $_REQUEST['query'];
Log::addEntry($q);
and the requested search will be logged.
segro replied on at Permalink Reply
thanks, that works fine.. quick'n dirty ;-)
stanleyB replied on at Permalink Reply
I also want to log search phrases. After adding Log::addEntry($q) method to root/blocks/search/controller.php all search phrases are recorded twice to log.

It looks like there are two instances of /search/controller.php as described here:http://www.concrete5.org/community/forums/customizing_c5/blockcontr...

Any suggestions to get around?
ryan replied on at Permalink Reply
ryan
quick and slightly less dirty - the second parameter will allow you to filter the logs to show only search terms...
function do_search() {
   $q = $_REQUEST['query'];
   Log::addEntry($q,'search_term');
//....


I'm betting you have more than one search block on your page. I only get one entry per request.
dubl0dude replied on at Permalink Reply
Does anyone know how to make this work in v 5.6? The proposed solution does not log search queries for me.