Results 1 to 9 of 9
  1. #1
    Join Date
    May 2007
    Posts
    139

    Unanswered: This is how search works

    Q:Well if I implement a SEARCH the INDEX(of a small town web site<-> index of town) webform, search for a record in db, the "name" field and "description" field of record and appear record data?
    This is how search works?

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Quote Originally Posted by lse123 View Post
    This is how search works?
    no, it is not
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    May 2007
    Posts
    139
    I mean local Site-wide search, ... how then?

  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    don't understand what you want

    do you want to implement a search then display the rows matching that search?

    if so then its issue a SQL command to get the data you want
    then in your front end populste whatever with that data.
    I'd rather be riding on the Tiger 800 or the Norton

  5. #5
    Join Date
    May 2007
    Posts
    139
    I MEAN TO HAVE DIFFER ENTRIES IN TABLE(category, name, description, url, tel, address) of shops, restaurants, cafes,...etc of a small town, and search a keyword in the Table, well I must SEARCH the "name" field and "description" field of record and appear record data OR SEARCH all columns of each row for the keyword?

  6. #6
    Join Date
    Dec 2007
    Location
    Richmond, VA
    Posts
    1,328
    Provided Answers: 5
    Why would you be asking us the above question? That would be yours or whomever the business owner of project to answer. For my part, I think you should query a single column, but then what good is my opinion for your app?
    Dave

  7. #7
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Quote Originally Posted by dav1mo View Post
    I think you should query a single column
    o rly?

    so instead of multiple columns in your table, which would require searching like this --
    Code:
    SELECT id
         , name
         , description
         , cuisinetype
         , ...
      FROM restaurants
     WHERE name LIKE '%searchstring%'
        OR description  LIKE '%searchstring%'
        OR cuisinetype  LIKE '%searchstring%'
        OR ...
    are you suggesting that all the data be stored in a single monolithic column to make the search query operate on a single column?
    Code:
    SELECT id
         , singledatacolumn
      FROM restaurants
     WHERE singledatacolumn LIKE '%searchstring%'
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  8. #8
    Join Date
    Dec 2007
    Location
    Richmond, VA
    Posts
    1,328
    Provided Answers: 5
    No, I was being facetious. Due to the ops inability to determine what it is they really want and asking us for the suggestion.
    Dave

  9. #9
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    people search for soemthing
    that search could be on one or more column(s)
    they could use an or on the same column
    ..nut its all part of the SQL

    the SQL is a translation of waht you want the db to return
    lets say you a tabel containing books, along with say a user ratings

    you could ask the db to return all rows containing SQL in the title and a rating of '5'
    eg
    Code:
    select my,column,list from mytable where title like "%SQL%" and rating>=5
    assuming the max rating was 5, and it was a decent bookstore that should return at least one row ('Simply SQL' by a certain Mr R Limeback)

    you coudl refine the where by adding more columns
    eg
    where businesstype="REST" AND StreetName like "%Main%" and BuildingNo>800 and BUILDINGNO<=900 and businessname like "%donald%"

    as to how you present that sort of information to your users is up to you
    you could populate a list box of rows matching those criteria

    if you are using a web interfazce you could use AJAX to filter down the number of possibilities
    fer istance Ive seen soem sites that have categories of say restaurants

    eg
    restaurants (150)
    ..fine dining (12)
    ..italian(30)
    ...French(.... and so on

    where the various categories county up to the 150

    the like if digikey, CPC/Farnell and others have a very good drill down approach, allowing you to add or remove search criteria till the customer finds what they want.
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •