Results 1 to 3 of 3

 

Thread: MySql Table Search

  1. #1
    Registered User

    Status
    Offline
    Join Date
    Dec 2003
    Location
    Leicestershire
    Posts
    106
    Thanks
    1
    Thanked 3 Times in 3 Posts


    I'm after a PHP search script that will index a MySql table and return the results including an image. I've tried search scripts that spider the page but it's just not doing what i want. The table also has 30,000 rows so i'm a bit concerned about speed.

    I'd like to the results to look simiar to how kelkoo return theres http://www.kelkoo.co.uk/sitesearch/s...ry=dvd+players

    I've scoured the internet, tried modding similar scripts myself all to no avail. Any ideas?

    David

  2. #2
    Registered User

    Status
    Offline
    Join Date
    Oct 2003
    Location
    Norfolk
    Posts
    99
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Originally posted by holmes
    I'm after a PHP search script that will index a MySql table and return the results including an image. I've tried search scripts that spider the page but it's just not doing what i want. The table also has 30,000 rows so i'm a bit concerned about speed.

    I'd like to the results to look simiar to how kelkoo return theres http://www.kelkoo.co.uk/sitesearch/s...ry=dvd+players

    I've scoured the internet, tried modding similar scripts myself all to no avail. Any ideas?

    David
    Bit confused but I think I know what you need.

    You should be able to set up a full text Index on the columns that contain the search terms that your after. This is done within MySQL. What it does is indexes each word that is 4 or more characters in length to provide a really fast search. The minimum word length can be changed but you will probibly have to get your host to do it. The variable is ft_min_word_len

    You can then do a select from php to do the search.
    PHP Code:
    $sql sprintf("SELECT *, MATCH(name,brand,description,category)
    AGAINST('%s') AS score from `products`
    WHERE MATCH(name,brand,description,category) AGAINST('%s') LIMIT %s,%s"
    $search_term$start$limit); 
    if $search_term = home +cinema , the returned recordset will contain all the rows containing the term home +cinema. It will also put them in order of relevance. I have added a limit to the sql statement. $start is the first record to fetch and $limit is the number of records to fetch. Use this for paging.

    Look at http://dev.mysql.com/doc/mysql/en/Fulltext_Search.html for more information.

    I have a table with over 280,000 rows and speed isn't really an issue using this method.

  3. #3
    Registered User

    Status
    Offline
    Join Date
    Dec 2003
    Location
    Leicestershire
    Posts
    106
    Thanks
    1
    Thanked 3 Times in 3 Posts
    Thanks for that Roger, i didn't realise it had that function.

    David



Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Quotation marks from datafeed DOUBLED in MySQL table
    By ukyellowpage in forum Programming
    Replies: 8
    Last Post: 22-02-05, 04:23 PM
  2. MSN announced a redesign for its MSN Search service
    By getvisible in forum Affiliate Marketing Lounge
    Replies: 0
    Last Post: 25-03-04, 09:41 PM
  3. ARELIS 3 Link Popularity Software
    By Qui Gon Jinn in forum Media Coverage & PR Strategy
    Replies: 4
    Last Post: 05-03-03, 06:34 AM

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
  •  
To Top

Content Relevant URLs by vBSEO 3.5.0 RC2