SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Guru
    Join Date
    Sep 2004
    Location
    Provo, UT
    Posts
    865
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    I need to create an "Advanced Search"

    My users can currently type in simple keywords to find testimonials that are in the datbase. Here is my query:

    SELECT tID, date, viewed, summary, MATCH (summary,testimony,keywords) AGAINST ('$q') AS score FROM testimonies WHERE MATCH (summary,testimony,keywords) AGAINST ('$q') and approved = 'Yes' limit 50
    What is the best way to tweak my search page so that it supports using quotations, negative keywords, etc? I would like it to be similar to how Google works.

    Thank you!
    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,332
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    embedded quotes, if needed, would have to be encoded in your search string

    negatives would be implemented with the minus sign

    see http://dev.mysql.com/doc/refman/5.1/...t-boolean.html
    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
    865
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    My new advanced search is working wonderful. 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
  •