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 > Smart Address search algorithm

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-31-08, 18:54
silas silas is offline
Registered User
 
Join Date: Mar 2007
Posts: 97
Smart Address search algorithm

Hello,

I'm trying to find way to let the user search for addresses in a database similar googles maps does. That means, if the search string is something like 'Denver' the user will get just one result, because there's only one city in the db with extactly the same name. If it is something like 'Denver av' there might be more results, including the streets, not the city. If it is 'Denver Av LA' its just one again, beacuse theres only one Denver Av in LA. Could also be 'LA Denver Av'. That means a set of combinations leads to the same result. In Google you can also search for 'Denver LA av', but that's not necessary. Anyone beeing occupied with this before? I'm thankful for every hint. Supported columns should be street, zip, city, streetno. Table has about 1000 rows. My first approach was to concat every column and use 'like'. But that did not really work. Hopy you have some ideas.

Thanks, silas
Reply With Quote
  #2 (permalink)  
Old 10-31-08, 20:05
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
the solution you are looking for will depend on exactly how you analyze the incoming user search string and translate it into an appropriate query

therefore, this is not a mysql question but rather an application language question

what are you using? php?
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 10-31-08, 20:12
silas silas is offline
Registered User
 
Join Date: Mar 2007
Posts: 97
Yes, php with mysql. I'm currently trying to solve this with a view or stored procedure. But still don't have a clue how to start. Maybe a regexp in a concated string?
Edit: And perhaps a extra column for the quality of the match.
Reply With Quote
  #4 (permalink)  
Old 10-31-08, 20:17
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
moving thread to php forum

seriously, you have to do the bulk of the logic in php

otherwise the SQL will not know when to search for denver as a city or denver as a street

you did, after all, stipulate that you wanted a smart address search algorithm

__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #5 (permalink)  
Old 10-31-08, 20:19
silas silas is offline
Registered User
 
Join Date: Mar 2007
Posts: 97
I want a sql solution. Pull me back.
Reply With Quote
  #6 (permalink)  
Old 10-31-08, 20:24
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
okay, it's your thread, i'll move it back to mysql forum

good luck getting a "smart" solution
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #7 (permalink)  
Old 10-31-08, 20:34
silas silas is offline
Registered User
 
Join Date: Mar 2007
Posts: 97
Thanks for your sarcasm. I'm pretty confident it's up in someones sleeve out there :-)
Reply With Quote
  #8 (permalink)  
Old 10-31-08, 22:15
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
Quote:
Originally Posted by silas
Thanks for your sarcasm.
oh, you're quite welcome, i think you earned it

__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #9 (permalink)  
Old 10-31-08, 22:38
silas silas is offline
Registered User
 
Join Date: Mar 2007
Posts: 97
Well, this is really starts annoying me. I posted a simple question and you blow up my thread with unreasonable comments.Too bad about this forum, I once really liked it.
Reply With Quote
  #10 (permalink)  
Old 10-31-08, 23:21
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
i don't think they were unreasonable, but i do apologize if you were offended

we have lots of competent mysql people here, don't give up yet...
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
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