SitePoint Sponsor

User Tag List

Results 1 to 7 of 7

Hybrid View

  1. #1
    SitePoint Guru
    Join Date
    Sep 2004
    Location
    Provo, UT
    Posts
    858
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Boolean search returning results when it should not

    I'm a bit puzzled why the following query returned any results at all. I purposely put a phrase in quotes that I new would not exist in any of the testimonials and yet, somehow, several rows were returned:

    select tID, date_format(dateAdded, '%m-%d-%Y') as dateAdded, views, title, MATCH (title,testimony,keywords) AGAINST ('"play baseball" +lemon bruis*') AS score from testimonies where approved = 'Yes' and match (title,testimony,keywords) against ('"play baseball" +lemon bruis*' in boolean mode) order by score desc limit 100

    Any thoughts on this one?

    Thanks!
    Convert your dollars into silver coins. www.convert2silver.com

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,220
    Mentioned
    58 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by busboy View Post
    Any thoughts on this one?
    how many total rows in the table?
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    SitePoint Guru
    Join Date
    Sep 2004
    Location
    Provo, UT
    Posts
    858
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Approaching 7,000 rows now after several years.
    Convert your dollars into silver coins. www.convert2silver.com

  4. #4
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,220
    Mentioned
    58 Post(s)
    Tagged
    3 Thread(s)
    okay, great

    sometimes people get weird results from fulltext searches because there are too few rows

    can you show the query results for a couple rows that were returned but shouldn't've been?
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  5. #5
    SitePoint Guru
    Join Date
    Sep 2004
    Location
    Provo, UT
    Posts
    858
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Ok, here is one example that was returned when it shouldn't have as it doesn't contain the exact phrase, "play baseball".

    Thanks!


    Title:
    Lemon oil as a deodorant

    Testimonial:
    I've wanted to stay away from the commercial deodorants for long time and couldn't find any natural products that helped. I received my Essential 7 kit and decided to try the lemon oil as a deodorant because in Ecuador people sometimes use lemon juice. Well, the lemon oil has worked perfectly and now that is the only thing I use. Also, one time I forgot to use lemon oil and since I keep Lavender oil at work, I used the Lavender oil and that worked so well!
    Convert your dollars into silver coins. www.convert2silver.com

  6. #6
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,220
    Mentioned
    58 Post(s)
    Tagged
    3 Thread(s)
    put a plus sign in front of the 'play baseball' and i'll bet this doesn't turn up
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  7. #7
    SitePoint Guru
    Join Date
    Sep 2004
    Location
    Provo, UT
    Posts
    858
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Oh, that did the trick. Thanks!
    Convert your dollars into silver coins. www.convert2silver.com


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •