SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast rekha_shp's Avatar
    Join Date
    Jan 2008
    Posts
    31
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help with Mysql fulltext search

    Hi,

    In my site I am using fulltext search to search data from the database using php query.But the search is not working properly and it retrieves irrelevant data.


    Can anyone pls guide me how to use mysql fulltext search efficiently.

  2. #2
    SitePoint Mentor bronze trophy
    John_Betong's Avatar
    Join Date
    Aug 2005
    Location
    City of Angels
    Posts
    1,901
    Mentioned
    74 Post(s)
    Tagged
    6 Thread(s)
    Quote Originally Posted by rekha_shp View Post
    Hi,

    In my site I am using fulltext search to search data from the database using php query.But the search is not working properly and it retrieves irrelevant data.


    Can anyone pls guide me how to use mysql fulltext search efficiently.
    Please supply:

    1. the search script
    2. results expected
    3. irrevelant results received



    .
    Learn how to be ready for The New Move to Discourse

    How to make Make Money Now with a *NEW* look

    Be sure to congratulate Wolfshade on earning Member of the Month for August 2014

  3. #3
    SitePoint Enthusiast rekha_shp's Avatar
    Join Date
    Jan 2008
    Posts
    31
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    The search query is "select title,subject,match(title,subject) against ('javascript in_array') from test where match(title,subject) against ('javascript in_array')>0 ".

    The result I obtain contains all the entry that contains a single word "javascript".But I want the result to be exact or most relevant.

  4. #4
    SitePoint Mentor bronze trophy
    John_Betong's Avatar
    Join Date
    Aug 2005
    Location
    City of Angels
    Posts
    1,901
    Mentioned
    74 Post(s)
    Tagged
    6 Thread(s)
    Quote Originally Posted by rekha_shp View Post
    Hi,

    The search query is "select title,subject,match(title,subject) against ('javascript in_array') from test where match(title,subject) against ('javascript in_array')>0 ".

    The result I obtain contains all the entry that contains a single word "javascript".But I want the result to be exact or most relevant.
    Try this in your PhpMyAdmin:
    PHP Code:

      SELECT title
    subject
      WHERE  
    (title LIKE '%javascript%'AND title LIKE '%in_array%')     
      OR
      
    WHERE  (subject LIKE '%javascript%' AND subject LIKE '%in_array%')
      
    FROM    test
      ORDER BY title 

    Hopefully you have the title and subject fields in your table structure set to _ci (case insensitive)


    .
    Learn how to be ready for The New Move to Discourse

    How to make Make Money Now with a *NEW* look

    Be sure to congratulate Wolfshade on earning Member of the Month for August 2014


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
  •