Re: Re: AND OR NOT
| From: | Jasper Bryant-Greene | Date: | Tue, 06 Sep 2005 04:33:59 +0000 |
| Subject: | Re: Re: AND OR NOT | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-221881@lists.php.net to get a copy of this message | ||
John Taylor-Johnston wrote:
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;-->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 Bryant-Greene Freelance web developer http://jasper.bryant-greene.name/ If you find my advice useful, please consider donating to a poor student! You can choose whatever amount you think my advice was worth to you. http://tinyurl.com/7oa5s