Page 1 of 1

Site searching with PHP

Posted: Mon Sep 29, 2003 10:24 am
by mikeb
Now, maybe it's just me, but I can't seem to find any help on searching with PHP. None of my books seem to mention it! What I'm wondering is, if I want to search text (html) files, binary (PDF, MS Word etc.) files etc, where's the best place to start? I'd like to be able to index results and then have users post a search form to find the content they need on the site. I've used Verity before with ColdFusion which made things reasonably easy. I'm not expecting a lot of code or anything, but a pointer in the right direction would be good,

any takers?

cheers,

Mike

Posted: Mon Sep 29, 2003 8:04 pm
by McGruff
With a search for $value = 'buff';

LIKE '%" . $value . "%' - returns buff, buffy, rebuffed

RLIKE '[[:<:]]" . $value . "[[:>:]]' - returns buff only, no suffixes or prefixes

That gives you a "loose" and an "exact" search.

A whole phrase / separate terms option would either loop through each term in turn or search for the whole phrase as a single term.

If you have mysql v4+, check out MATCH: ranking and boolean options.