Re: Re: AND OR NOT
| From: | John Taylor-Johnston | Date: | Wed, 07 Sep 2005 02:09:51 +0000 |
| Subject: | Re: Re: AND OR NOT | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-221940@lists.php.net to get a copy of this message | ||
Jasper Bryant-Greene wrote:
John Taylor-Johnston wrote: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. JohnI'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,