Re: Homebrew fulltext search function (help)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux