|
Posted by Richard Lynch on 02/01/05 20:05
Jason Morehouse wrote:
> within a sqlite call. This pases matched content to a function, where
> the function needs to pass back a score:
>
> sqlite_create_function($sDB, 'fulltext', 'fulltext_step',2);
>
> function fulltext_step($title, $content) {
> $words = explode(' ', strtolower('php books'));
$words = explode(' ' , strtolower($title));
> $content = explode(' ',strtolower($content));
> $content = array_intersect($content,$words);
> foreach($content as $wordpos => $word) {
> print "$wordpos - $word<br>";
> }
return count($content);
> }
That's a crude first take.
You could also add mega-points for, say, stristr($title, $content) for an
exact match, or more points for proximity of $word within $content (which
you'd need to do a different algorithm than above) or...
--
Like Music?
http://l-i-e.com/artists.htm
[Back to original message]
|