Posted by David Robley on 09/05/05 16:50
John Taylor-Johnston wrote:
> Any ideas? Post kind of lost in there since Saturday. Is str_replace the
> best choice for case sensitive and for swapping " AND "?
>
>> <input TYPE="text" NAME="searchenquiry" VALUE="" size=30>
>>
>> Any suggestion on how to swap AND OR NOT for mysql fulltext syntax in
>> $searchenquiry?
>> A simple parse for " AND " and then str_replace? Is str_replace
>> appropriate for case?
>
> John
I think you have a slightly more complex situation than just replacing text
between what I assume is a LIKE or multiple WHERE situation and a fulltext
search. Perhaps if you can give an idea of the type of string you are
likely to get in $searchenquiry, and to what you wish to convert it, we
might be better placed to give advice.
I can envisage that you might get 'bananas NOT pears AND apples' in the
variable; I guess you would currently manipulate that to a query such as
"WHERE x = 'bananas' AND x <> 'pears' AND x = 'apples'"
(OK that's not a good example) but if you were to feed that to a fulltext
search you might want
WHERE MATCH (x) AGAINST ('+bananas -pears -apples' IN BOOLEAN MODE)
or maybe something else depending on the version of Mysql and exactly what
you are trying to do with your fulltext search.
Cheers
--
David Robley
Why do cats have canine teeth?
[Back to original message]
|