Re: Array or SQL?
| From: | michael kimsal | Date: | Thu, 28 Feb 2002 13:30:35 +0000 |
| Subject: | Re: Array or SQL? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-86595@lists.php.net to get a copy of this message | ||
Kristjan Kanarik wrote:
Hi, I've never had reason to get deeply into array functions, but now it is very likely needed. I'm working on a small search engine (to search text from articles) and I'm not sure wheter I will be able to complete it without any external help. <snip>
I feel very uncomfortable both with array's and complicated SQL queries, therefore I wonder if somebody could show me the way? The solution letting MySQL to do the job is probably faster and therefore prefered... I guess. Or not?You are right to let MySQL handle the job. If you've a moderately recent version of MySQL, you should investigate the idea of 'FULLTEXT' searching. Basically you create a FULLTEXT index on one or more columns in a table, and have MySQL do a 'match' of a phrase against that index. It'll handle multiple words in a phrase, and filter out stop words, etc. It's pretty handy, and can return 'relevance', although it won't be '# of times word occured' as you're looking for. Contact me if you want more info. Michael Kimsal http://www.phphelpdesk.com 734-480-9961