Archive for June, 2010

CakePHP Full Text Search

June 20th, 2010

CakePHP’s database abstraction is just one of the reasons to use this powerful framework for agile web development. However, it is not always obvious how to build complex queries. I recently had to implement a MySQL full text search against a music database that searched on titles, descriptions and tags. Full text search is a quick, and not too dirty way to make a pretty decent search, although it does come with a caveat, as described in the MySQL documentation:

Full-text indexes can be used only with MyISAM tables, and can be created only for CHARVARCHAR, or TEXTcolumns.

It did take a little bit of experimentation to get the syntax for the query correct in CakePHP as the query is a little different from the regular “SELECT field FROM table WHERE somevalue = somevalue“.

So, for this example I will use a MyISAM table called pages and search against the title, content and tags fields for the term” jquery web development”. You should substitute that term with your dynamically passed value in the code below.

Firstly I built the conditions for my query into a “params” array.

$params['conditions'] = array(
‘MATCH(Track.title,Track.description,Track.tags)
AGAINST(”‘ . $kw_list . ‘” IN BOOLEAN MODE)’
);

$params= array(’conditions’ => array(
‘MATCH(Page.title,Page.description,Page.tags)
AGAINST(”jquery web development” )’ ));

Finally a call to CakePHP’s native find method will perform the search:

$this->Page->find(’all’,$params);

One last note: MySQL full text search can be powerful when used correctly and a potential bottleneck when poorly implemented. I suggest reading the documentation for further information and more advanced usage.

A health insurance example of how SEO is dead, long live Online Marketing.

June 7th, 2010

At Zumo Internet, when we started a new campaign for health insurance company, WPA one of the things we have noticed over the last year is that whilst SEO is not entirely dead, there are so many more avenues to explore when trying to boost traffic to websites.

For instance, we had to research the private health insurance industry to see exactly what services were offered and what users were likely to search for when they were trying to find private medical insurance. In doing so, we realised that there are a great number of concepts in the health insurance industry that were not understood to the leyman. Even the costs or the ability to use private medical insurance to fast track in the NHS were concepts new to us. So we were researchers in the medical insurance industry.

Then we found ourselves having to compose press-releases, articles and surveys connected to the health insurance industry in order to help people better understand once they hit the site as well as change site copy to make a balance between discovery by search engines and human readability. So we were copywriters.

Finally we had to get all this information into a well-presented and readable report showing what people were searching for when they were looking for medical insurance and what the effects of our works was. So were statisticians.

SEO seems such a misnomer for the work that goes into driving relevant traffic to sites. So we now opt for the label Online Marketing.