We had a job where we needed to perform a ZIP code radius search. So like everyone else we went out and looked at what was in the Macromedia Developers Exchange. We downloaded all of the free tags, and bought a couple of the ones that were commercial. However, we noticed a few problems with all of them:
- The tags were written with the database table and field names hardcoded inside. In some cases the authors recommended the purchase of a particular (and really expensive) database. In others they included a free database, but it wasn't up to date. If we wanted an up-to-date ZIP code list (we did) we were stuck using a very expensive commercial db. If we wanted to use a different tag, we were stuck with the db that came with it, or had to take the time to rewrite it so it worked with the database of our choice.
- The tags out there were all dogs! Sure, they worked, but one commercial tag in particular came in at something like 30-80000 (yes, thats thirty thousand to eighty thousand) milliseconds to run! The reason was the tags were looping over the entire ZIP code database to make its match/mismatch determination. What was needed was a results search that limited itself to only a segment of the database.
There were a couple of tags that did that. One -- a pretty popular one -- had boatloads of extra code in it that we didn't need, and was hardwired very tightly with a particular -- and unnecessarily expensive -- commercial database. To find out whether it performed decently would have cost either about US$250 or a lot of time to recode the tag to use something reasonably priced. There was only one other, and it looked reasonably simple to fix up. That tag was the popular FreeZip tag.
This tag performed reasonably, but as the author acknowledged it was a bit of a kludge, and as we discovered through testing was hardwired to run searches out to only about 45 miles... we needed 200 mile maxes.
So we rewrote it. Essentially its a completely new tag that keeps only FreeZip's original radius determination algorithm, which is now supplemented by the ability to expand the search radius Performance is dramatically better, the tag works with any database. We paid only US$39.95 for this one and further enhanced speed by running through it and creating an optimized database that contained only the information we needed (the routine to do this is included iwth ZIPMonger).