SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Wizard Zaggs's Avatar
    Join Date
    Feb 2005
    Posts
    1,045
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    MySQL MATCH AGAINST and NOT LIKE

    Hi Guys!

    I have a search function on my website and I need to do a boolean search on a fulltext index.

    For example, currently I am doing this:

    Code:
    match jobs.job_title against ('developer')
    This works absolutely fine. However, I also have a function where the user can enter negative keywords. If they enter negative keywords, for example, "php" then results containing "php" will not be returned.

    I thought of adding some extra sql like this, but is this the correct way to do things?

    Code:
    and (jobs.job_title not like '%php%' 
    and jobs.job_description not like '%php%'
    and companies.company_name not like '%php%')
    Thanks in advance.

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,015
    Mentioned
    53 Post(s)
    Tagged
    2 Thread(s)
    Quote Originally Posted by Zaggs View Post
    ...but is this the correct way to do things?
    what happened when you tested it?

    r937.com | rudy.ca | Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    SitePoint Wizard Zaggs's Avatar
    Join Date
    Feb 2005
    Posts
    1,045
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by r937 View Post
    what happened when you tested it?

    It worked. I just wondered if there would be a discrepancy between the MATCH and NOT LIKE stataments...


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
  •