If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > This is how search works

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-12-10, 05:06
lse123 lse123 is offline
Registered User
 
Join Date: May 2007
Posts: 139
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?
Reply With Quote
  #2 (permalink)  
Old 07-12-10, 06:13
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,525
Quote:
Originally Posted by lse123 View Post
This is how search works?
no, it is not
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 07-12-10, 08:53
lse123 lse123 is offline
Registered User
 
Join Date: May 2007
Posts: 139
I mean local Site-wide search, ... how then?
Reply With Quote
  #4 (permalink)  
Old 07-12-10, 09:39
healdem healdem is online now
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,250
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 my Versys or my Tiger 800 let alone the Norton
Reply With Quote
  #5 (permalink)  
Old 07-12-10, 15:25
lse123 lse123 is offline
Registered User
 
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?
Reply With Quote
  #6 (permalink)  
Old 07-12-10, 16:09
dav1mo dav1mo is offline
Registered User
 
Join Date: Dec 2007
Location: Richmond, VA
Posts: 782
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
Reply With Quote
  #7 (permalink)  
Old 07-12-10, 16:21
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,525
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%'
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #8 (permalink)  
Old 07-13-10, 08:38
dav1mo dav1mo is offline
Registered User
 
Join Date: Dec 2007
Location: Richmond, VA
Posts: 782
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
Reply With Quote
  #9 (permalink)  
Old 07-13-10, 09:30
healdem healdem is online now
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,250
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 my Versys or my Tiger 800 let alone the Norton
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On