You are here: Re: [PHP] Homebrew fulltext search function (help) « PHP « IT news, forums, messages
Re: [PHP] Homebrew fulltext search function (help)

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация