| Welcome to WebmasterWorld Guest from 22.214.171.124 |
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
|Subscribe and Support WebmasterWorld|
|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.
© Webmaster World 1996-2013 all rights reserved