Re: AND OR NOT

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



David,

I'm under pressure to permit AND, OR & NOT. My research group insists that MySQL 4 syntax is "not good enough".

An idea of what one might enter is here (on the bottom): http://compcanlit.usherbrooke.ca/advanced.html

I was hoping to get away with replacing " AND " with "+", " NOT " with "-" and " OR " with " ".

I use this as SQL:

SELECT *,MATCH (YR,AU,ST,SD,SC,BT,BD,BC,AT,AD,AC,JR,KW,AUS,TUS,GEO,AN,SA,RB)
AGAINST ('$mydata->searchenquiry' IN BOOLEAN MODE)
AS relevancy FROM ccl_main
WHERE MATCH (YR,AU,ST,SD,SC,BT,BD,BC,AT,AD,AC,JR,KW,AUS,TUS,GEO,AN,SA,RB)
AGAINST ('$mydata->searchenquiry' IN BOOLEAN MODE)
ORDER BY relevancy DESC;-->

John


David Robley wrote:

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.



--
John Taylor-Johnston
-----------------------------------------------------------------------------
"If it's not Open Source, it's Murphy's Law."

°v° Bibliography of Comparative Studies in Canadian, Québec and Foreign Literatures
/(_)\ Université de Sherbrooke
^ ^ http://compcanlit.ca/ T: 819.569.2064

--
John Taylor-Johnston
-----------------------------------------------------------------------------
"If it's not Open Source, it's Murphy's Law."

 ' ' '    Collège de Sherbrooke:
ô¿ô    http://www.collegesherbrooke.qc.ca/languesmodernes/
   -     819-569-2064

 °v°   Bibliography of Comparative Studies in Canadian, Québec and Foreign Literatures
/(_)\  Université de Sherbrooke
 ^ ^   http://compcanlit.ca/ T: 819.569.2064


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux