SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Jan 2005
    Location
    doberman
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help with a search query.

    Hey SP,

    I have been working on a little search page for a client and can't seem to get this nailed down.Search form looks like this:

    Title: (FullText MySQL)
    Author:
    County:
    State:

    When I do a search for something like "Sacramento City Directory" from the title field,

    The query that get run looks like this:
    Code:
    SELECT * FROM DATABASENAME WHERE MATCH(title) AGAINST('"Sacramento City Directory"' IN BOOLEAN MODE) ORDER BY state,county,title ASC
    The result I get will only give back results that contain "Sacramento City Directory". What I need is to get a result set back with any row containing all of the words, in any order that occur in the title.

    What am I doing wrong?

    Thank SP,

    Greg
    Got logical business solutions? Get SuM!
    Greg Starr (SuM)
    LogicStation.net
    Florida Based Contract Web Developer

  2. #2
    SitePoint Wizard guelphdad's Avatar
    Join Date
    Oct 2003
    Location
    St. Catharines, ON Canada
    Posts
    1,708
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I had a quick peek at the manual. I haven't performed one of these before. Seems like you need a plus symbol in front of each word like so:
    Code:
      SELECT * FROM DATABASENAME 
      WHERE MATCH(title) 
     AGAINST('+Sacramento +City +Directory' IN BOOLEAN MODE) 
      ORDER BY state,county,title ASC
    The spot in the manual for boolean full text search info if you or someone else needs it:
    http://dev.mysql.com/doc/mysql/en/Fulltext_Boolean.html

  3. #3
    SitePoint Member
    Join Date
    Jan 2005
    Location
    doberman
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks man that was it!!! Good loooking out.
    Got logical business solutions? Get SuM!
    Greg Starr (SuM)
    LogicStation.net
    Florida Based Contract Web Developer


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
  •