Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Part of the Drupal.org re-design involves the creation of a UX toolkit offering better search, and using the results of searches to inform the information architecture.
This page has existed for a while: http://drupal.org/search-queries in an unpublished state. The concern was that this is a very intensive query and traffic to this page would have a serious impact on performance. We now need a subset of this information to ensure that the most popular searched topics can be found easily. Can we modify this page so it uses a cache, or has less of a performance impact?
$result = db_query("select message, count(message) as count from watchdog where type = 'search' and uid = 0 group by message order by count desc limit 300");
print '<div class="column-left"><h2>Anonymous users</h2><ul>';
while ($s = db_fetch_object($result)) {
preg_match('!<em>(.*?)</em>!', $s->message, $matches);
print '<li>'. $matches[1] .' ('. $s->count .')</li>';
}
print '</ul></div>';
$result = db_query("select message, count(message) as count from watchdog where type = 'search' and uid != 0 group by message order by count desc limit 300");
print '<div class="column-right"><h2>Authenticated users</h2><ul>';
while ($s = db_fetch_object($result)) {
preg_match('!<em>(.*?)</em>!', $s->message, $matches);
print '<li>'. $matches[1] .' ('. $s->count .')</li>';
}
print '</ul></div>';
Comment | File | Size | Author |
---|
Comments
Comment #1
Amazon CreditAttribution: Amazon commentedKhalid added this code into the drupalorg module. Thank-you!
http://drupal.org/authenticated-search-queries
Comment #2
Anonymous (not verified) CreditAttribution: Anonymous commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #3
Amazon CreditAttribution: Amazon commentedI'd like to add a link to the search results beside each term. Is there a way to see which terms get clicked on from the search results?
It would be helpful to have more insight into search results to inform our IA for the redesign.
Kieran
Comment #4
kbahey CreditAttribution: kbahey commentedI am not sure I can visualize what you need, nor how it would work. Google does that by tracking the onmousedown event, then triggering some javascript that registers the click.
However, you can already get the info you want for d.o from the Apache log. Just filter by the referer http://drupal.org/search/node/ and you know that it was clicked from the search page. A perl script can do that for sure.
Comment #5
Amazon CreditAttribution: Amazon commentedAdd a link to search results, so that people can see what results are provide. Thanks for the tip about search the Apache logs.
Comment #6
silverwing CreditAttribution: silverwing commentedQueue Cleanup
Amazon, does anything else need to be done with this? Tag for the redesign team?
Comment #7
Amazon CreditAttribution: Amazon commentedMoving over to the redesign queue. This is probably something we can now get from Solr easily.
Comment #8
joegml CreditAttribution: joegml commentedAs kbahey says, much goodness resides in the d.o apache logs and is grokkable by a perl script. I had done some earlier work on finding the most popular downloads via a perl script accessing the analog data files. Analog files contain no IP addresses or agent identifiers and so no spam filtering is possible on them. I think the downloads popularity is now addressed with the update_status module, but issues still remain as to how accurate the reported numbers are.
In terms of this topic kbahey is basically right, it should be a straightforward perl script and it seems to me this would be a good way to track searches: the raw data's already there. The perl script could chug away in the background and digest Apache logs in the CPUs slow time. One dicey bit is sorting out the robots: the Apache logs list all hits. Do robots enter search phrases?
Comment #9
drummLooks like Google Analytics is tracking this.