SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Nov 2001
    Location
    Coventry, England
    Posts
    46
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Search Facility for MySQL

    Hi,

    I am trying to implement a search facility on a MYSQL database. The MySQl statement I am using is:

    Code:
    "SELECT  *, Sections.Title as SectionTitle, Sections.Description as SectionDescription FROM Sections,Treatment
    WHERE Sections.ID=SectionID AND Treatment.Title REGEXP '$searchtext'AND Men=1
    What I want to be able to do is search in more than one column so I can search both Titles and Content for the word and it could appear in either?

    Also does anyone have any ideas about how to add greater search functionality, ie if someone searches for a word in the plural and it only appears in the singular then this search will return no result is there any way round this?

    Also if I want to search for two words this relies on them being next to each other in excatly the way I typed them, is there any way round this?

    Thanks
    Ian

  2. #2
    midnight coder
    Join Date
    Dec 2000
    Location
    The flat edge of the world
    Posts
    838
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Have you had a look at MySQL's FULLTEXT function?

    http://www.mysql.com/doc/F/u/Fulltext_Search.html

    It allows you to search across multiple columns, and even ranks relevance of results for you. See if it's any use to you.
    Work smarter, not harder. -Scrooge McDuck

  3. #3
    SitePoint Enthusiast
    Join Date
    Nov 2001
    Location
    Coventry, England
    Posts
    46
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The problem with FULLTEXT is that it does not support part words so if I search for 'faci' it wont find 'facial' and my ISP is only running MySQL version 3.23.39 .

    Any other suggestions?

    Thanks
    Ian


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
  •