Re: Re: AND OR NOT

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

 



Jasper Bryant-Greene wrote:

John Taylor-Johnston wrote:

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;-->

Please don't top-post [1]. Nice cryptic column names, by the way :)
Your research group obviously haven't researched very carefully, as "+term" is exactly equal to " AND term", "-term" to " NOT term" and simply "term" to " OR term". So there's no point in complicating the syntax. Not only that, but MySQL's boolean mode fulltext search offers many more great possibilities like truncation ("app*" will match "apple", "application"...) and in-query relevance altering. Take a look at the BOOLEAN MODE section of the MySQL manual [2]; maybe print it and give it to your research group :)
[1] http://en.wikipedia.org/wiki/Top-posting
[2] http://dev.mysql.com/doc/mysql/en/fulltext-boolean.html

Jasper,

God only knows I have tried. They're old school, what more can I say. If you knew how hard it was to sell them on using PHP-MySQL, when the project was floundering on a MS-Access & ASP server ! They insist on AND, OR & NOT - I have tried. Heck, I have an advanced page with it all spelled out. But it is a good project to hone my owns skills on.

So ... a simple str_replace will work. str_replace is case sensitive, if I read the manual correctly?

I can get away with: " AND " with "+", " NOT " with "-" and " OR " with " " ?

Top-posting? Oh, sorry. I guess I'm old school and stubborn myself. Ok, I'll try working on the bottom of the page.

John

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[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