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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php