| Welcome to WebmasterWorld Guest from 184.108.40.206 |
register, login, search, subscribe, help, library, PubCon, announcements, recent posts, open posts,
|Pubcon Platinum Sponsor|
|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 ® and PubCon ® are a Registered Trademarks of Pubcon Inc.
© Pubcon Inc. 1996-2012 all rights reserved