Thread: text searching

    #1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2003
    Posts
    4
    Rep Power
    0

    Unhappy text searching


    I have built a directory that allows users to search via business names.

    The data is stored in MS Sql database.
    The website has been been developed using asp scripting.

    My problem comes down to this.

    If a user searches for joe smith refridgeration they can do so by entering joe, smith, joe smith, refridgeration, joe smith refridgeration, smith refridgeration

    but i need to make it work if some enters refridgeration joe smith, joe refridgeration etc.

    Is this possibe?

    Does anyone know how to do it?

    Thanks in advance.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2003
    Location
    BC, Canada
    Posts
    32
    Rep Power
    12
    Have you ASP code generate a query that has a LIKE statement for every search term like the example below.

    SELECT * FROM datatable
    WHERE textdata LIKE '%refridgeration%'
    AND textdata LIKE '%joe%'
    AND textdata LIKE %'smith%'
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2003
    Posts
    4
    Rep Power
    0
    Currently the user is inserting all that data into the one field.
    So how would I go about splitting the field down into seperate query string elements?
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2003
    Location
    BC, Canada
    Posts
    32
    Rep Power
    12
    Not sure how to do it in ASP, but it can't be that difficult. I think you wout use the cut function.
  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2003
    Posts
    7
    Rep Power
    0
    i use frontpage to modify asp pages and i have a database results proporties options and it lets me split a text field up separated by commas or whatever and you can do your query with like or contains based on a specific field.
  10. #6

IMN logo majestic logo threadwatch logo seochat tools logo