SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    Apr 2004
    Location
    PA
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    using SOUNDEX in MySQL to do a search

    I'm doing a project for people to go onto a web page at lan parties to request music to be played, then the songs will automaticly be played on a custom mp3 player. I have almost everything done. the only thing I don't have finished yet is the search feature. that has me stumped. here's my problem. I would like to have mysql use the soundex function to search all the filenames for a word or words. is this possible by only one query? I guess I might have to have php do all the work searching, which would be pretty slow and lag the server down. there's a list of 5000 files to search. takes 4 seconds on my athlon 1700 just to build the file list and add to mysql. any help with this problem would be great, and if anyone wants a copy of my finished product, just let me know.

    Matthew Kemmerer
    Mattsoft.net

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,250
    Mentioned
    59 Post(s)
    Tagged
    3 Thread(s)
    yes, it's possible
    Code:
    select productname
         ,soundex(productname)
      from products
      
    widget,W323
    doodad,D000
    thingie,T520
    gizmo,G500
    gadget,G323
    dingus,D520
    gewgaw,G000
    knickknack,K5252
    whatnot,W353
    foofaw,F000
    widget2,W323
    doodad3,D000
    gizmo3,G500
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    SitePoint Member
    Join Date
    Apr 2004
    Location
    PA
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by r937
    yes, it's possible
    Code:
    select productname
         ,soundex(productname)
      from products
      
    widget,W323
    doodad,D000
    thingie,T520
    gizmo,G500
    gadget,G323
    dingus,D520
    gewgaw,G000
    knickknack,K5252
    whatnot,W353
    foofaw,F000
    widget2,W323
    doodad3,D000
    gizmo3,G500
    thanks, but that's not exactly what I wanted to do. the values in the database are set up like, marilyn manson - the beautiful people.mp3. I want to do a multi word search in those values. like a search for 'manson people' would return that result.

    Matthew Kemmerer
    Mattsoft.net

  4. #4
    Mlle. Ledoyen silver trophy seanf's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    7,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Perhaps a full-text index would be better then

    Sean
    Harry Potter

    -- You lived inside my world so softly
    -- Protected only by the kindness of your nature

  5. #5
    SitePoint Member
    Join Date
    Apr 2004
    Location
    PA
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by seanf
    Perhaps a full-text index would be better then

    Sean
    thanks! I think that might work. I'll just create another field for the soundex version of the song name.


    Matthew Kemmerer
    Matsoft.net


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
  •