ShortStat with lowercase search terms

I’ve recently taken more serious approach for following the search terms people use to find Nomadig.com. The reviews section seem to gather a good number of hits from Google and other search engines. This journal is also a prime candidate, as all reviews are shown here, too.

Some people either write grammatically correctly or copy’n'paste names and other terms that have uppercase letters. For example, both Spaksmannsspjarir and spaksmannsspjarir have appeared. Unfortunately, ShortStat is not able to count them as one term. Instead I have several variations of the same name in the stats.

I finally decided to do something. Fast glance to ShortStat source code revealed that I could manipulate the SQL query to be case-insensitive. This approach has the basic flaw that if the first search term has uppercase letters, those letters are stored as is in the database. All future searches would just update the count and the search terms display would look ugly.

Instead of fixing the query, I simply added one PHP line to convert the search terms into lowercase before sending anything to the database.

To have the fix, find fuction SI_sniffKeywords($url) and the following line:

if (isset($searchterms) && !empty($searchterms)) {

Add the following line below that line:

$searchterms = strtolower($searchterms);

Presto! Now you have case-independent ShortStat search terms module. There is one bummer, though. If you have used ShortStat for a while, there may be several different variations of the same terms in the database already. I’ve selected not to do anything for those entries for a while, as in the long run they will be pushed down in the display anyhow.

Comments

The URI to TrackBack this entry is: http://www.nomadig.com/2005/04/06/shortstat-with-lowercase-search-terms/trackback

No comments yet.

Leave a comment

The following Textile shortcuts are available:

_emphasis_
*strong*
@code@
^superscript^
~subscript~
+inserted text+

Hyperlink:
"link text":http://link.url

Image:
!http://image.url!

Lists:
* bulleted
# numbered

Hide help

Please be polite and use common sense when posting. Any comment is subject to removal. The e-mail address is required, but it is not shown to anybody else than the administrator.

Commenting uses Textile and your message is previewed below. Show Textile help

Write your comments

 

Preview

1.  — Jan 6 2009