Match Vs Where - Fulltext Search
| From: | Harlequin | Date: | Mon, 27 Sep 2004 23:43:29 +0000 |
| Subject: | Match Vs Where - Fulltext Search | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-198098@lists.php.net to get a copy of this message | ||
Hi all.
It took me some time to discover that you can't use a "MATCH | AGAINST"
statement unless you create an fulltext index of the fields to search at the
same time. Strange, I know.
What's more strange is that as I read more I wonder why people use it
because it will only seartch complete words, will not search on words that
are 3 characters or less, treats hyphenated words as seperate words and has
a whole long list of excluded words.
OK, so I'll use the following:
[code]$query = "SELECT * FROM MembersData
WHERE
UserID
LIKE '$Keyword01'
or UserID
LIKE '$Keyword02'
or UserID
LIKE '$Keyword03'
or UserID
LIKE '$Keyword04'
or UserID
LIKE '$Keyword05'";
$Data = mysql_query($query) or die("Error 1: " . mysql_error());[/code]
But the only problem I see with this is that although it allows me to search
using wildcards and partial words it seems a very lengthy way of completing
the task because I think I would have to repeat this statement with
something like "OR WHERE" for each field I wanted to search.
I know this post is lengthy and I apologise for putting you to sleep but I'd
really love to get to the bottom of this one sometime soon. Has anyone else
experienced similar frustrations searching their databases - I can't be the
only one...!
--
-----------------------------
Michael Mason
Arras People
www.arraspeople.co.uk
-----------------------------