Re: Emulating Filemaker search on MySQL
| From: | Brent Baisley | Date: | Thu, 08 May 2003 15:34:52 +0000 |
| Subject: | Re: Emulating Filemaker search on MySQL | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-27585@lists.php.net to get a copy of this message | ||
I'm doing the same thing. You're going to have to do some of your own parsing to get the search words in a format that MySQL would like. You're also going to have to implement full text indexing for searching. I would highly recommend upgrading to v4 of MySQL to do your full text searching.
In your example, you would want to add a + to the start if each word and an * to the end of each word. Which is actually each to do:
$searchStr = '+'.str_replace(' ','* +',$userEnteredText).'*'
Your search string would then end up being: +wash* +mem* +hosp*
MySQL can also do relevance ranking of the results, something FileMaker can't do. You can also make certain words more or less relevant than others. It's just a matter of parsing what the user enters.
On Thursday, May 8, 2003, at 08:59 AM, George Pitcher wrote:
I am currently in the planning stage of a replacement of my Lasso/Filemaker site. I've tried out various bits of functionality to get it all to hang together. I have a question about where I'll be able to bring one of Filemaker's search tricks to MySQL and PHP. If a user searches for: (unquoted) wash mem hosp, they would find any records where Washington Memorial Hospital exists, but not washed out memory (no 'hosp' found). I can tighten things up by doing an exact match/begins with/ends with. Can I do the same with PHP/MySQL without asking the user to put '*' into the search string? -- Brent Baisley Systems Architect Landover Associates, Inc. Search & Advisory Services for Advanced Technology Environments p: 212.759.6400/800.759.0577