| Welcome to WebmasterWorld Guest from 220.127.116.11 |
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
|Pubcon Platinum Sponsor 2014|
|MySQL Match HAVING Score|
trying to bring back an accurate match count based on score
| 8:39 pm on Mar 27, 2011 (gmt 0)|
I am trying to bring back a count based on scores over a certain value. Here's my code in my PHP script that calls the database.
SELECT count(MATCH ( `title`) AGAINST ('+(apples) ' IN BOOLEAN MODE )) as Score FROM `inventory` WHERE MATCH ( `title`) AGAINST ('+(apples) ' IN BOOLEAN MODE) HAVING Score > 1;
The problem is the count returned is always the total of all matches in my database regardless of how high I make the score.
So if I say HAVING Score > 9 it still returns the same as HAVING Score > 1.
How do I return an actual count based on how many lines actually match the Score setting?
FYI when I pull the actual data without a count, the script only pulls the data that matches the score.
Here is an actual data pull
SELECT *, MATCH ( `title`) AGAINST ('+(apples) ' IN BOOLEAN MODE ) as Score FROM `inventory` WHERE MATCH ( `title`) AGAINST ('+(apples) ' IN BOOLEAN MODE) HAVING Score > 1
and that will bring back only matches that match the Score set as well. So this one works fine, just can't get an accurate count based on Score.
All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved