Advertisement

09.24.2007 at 06:56AM PDT, ID: 22848226
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.0

MySQL FULLTEXT with MATCH AGAINST for Fuzzy Address Matching

Asked by ein_mann_betrieb in MySQL Server

Tags: , , , ,

Dear EE members,
   I am at a loss here so if anyone can help I would greatly appreciate it!

I have a MySQL server v4.1.21 out of my control (run by a hosting company).

CREATE TABLE `contacts` (
  `TransID` bigint(15) unsigned zerofill NOT NULL default '000000000000000',
  `FName` varchar(20) NOT NULL default '',
  `LName` varchar(30) NOT NULL default '',
  `Add1` varchar(254) NOT NULL default '',
  `City` varchar(45) NOT NULL default '',
  `State` char(2) NOT NULL default '',
  `ZIP` varchar(10) NOT NULL default '',
  PRIMARY KEY  (`TransID`),
  KEY `INDEX` (`LName`,`Add1`),
  FULLTEXT KEY `FULLTEXT` (`Add1`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

I currently have about 20K entries.

I am really only having trouble finding one entry, but I am concerned that this may not be isolated.
I am running the following query:
SELECT `TransID` FROM `contacts`
WHERE (
`FName` = 'john'
AND `LName` = 'doe'
AND MATCH (`Add1`) AGAINST ('"6" oak street' IN BOOLEAN MODE)
AND `City` = 'Sometown'
AND `State` = 'PA'
AND `ZIP` = '17356'
) ORDER BY `TransID` DESC

** The query is modified to protect personal data **

I had decided in the design phase to use MATCH AGAINST so that we can accomidate for 'user mistakes' between the data and the searching form.  For example, the database will most likely have the USPS style of address '6 OAK ST.' and the user may search '6 oak street'.  Normal LIKE will fail here unless I try to be smart and remove common words like 'street', 'avenue', etc.

It seemed like everyone worked without a hitch, but this one query fails to find any results if the `Add1` MATCH is left in the query.
Even when I query as simple as "SELECT * FROM `contacts`WHERE MATCH (`Add1`) AGAINST ('6 oak' IN BOOLEAN MODE)" I get no results, but if I do a manual LIKE statement there are two '6 oak' entries, one at a '6 oak street' and one at a '6 oak lane'.

Am I maybe using this the wrong way?  Is there a better method?
I am concerned that MySQL is not indexing it becuase '6' and 'oak' are so common in addresses...

Thanks in advance!  -Cheers, Peter.Start Free Trial
 
Loading Advertisement...
 
[+][-]09.24.2007 at 12:08PM PDT, ID: 19950826

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: MySQL Server
Tags: mysql, match, against, fuzzy, fulltext
Sign Up Now!
Solution Provided By: wasifg
Participating Experts: 1
Solution Grade: A
 
 
[+][-]09.26.2007 at 08:05AM PDT, ID: 19963644

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.04.2007 at 02:27PM PDT, ID: 20018010

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_1_20070628