tags:

views:

59

answers:

1

Hello all, I put together a very simple search engine based on an article un zend's website using fulltext. My understanding is that if a keyword scores 50% or more, this will be dropped. This is good, but I know my client is not going to like it. I know they expect some keywords to be shown within a search result.

My main problem is that if I search for, lets say 'house', it doesn't pull anything up; yet we can clearly see that there is an entry for it in various places.

Here is my script

$sql = "
 SELECT *,
 MATCH(title, content) AGAINST('$keyword') AS score
 FROM articles
 WHERE MATCH(title, content) AGAINST('$keyword')
 ORDER BY score DESC 
";

Is there a way to alter the score to get more results for exact wors? if so how?

Thanks

A: 

The score is computed automatically, I don't think you can change it. Try doing:

$sql = "
 SELECT *,
 MATCH(title, content) AGAINST('" . $keyword . "') AS score
 FROM articles
 WHERE MATCH(title, content) AGAINST('" . $keyword . "')
 ORDER BY score DESC 
";

or

$sql = "
 SELECT *,
 MATCH(title, content) AGAINST('" . $keyword . "' WITH QUERY EXPANSION) AS score
 FROM articles
 WHERE MATCH(title, content) AGAINST('" . $keyword . "' WITH QUERY EXPANSION)
 ORDER BY score DESC 
";
Alix Axel