[FX.php List] Fix for interesting search...

Bob Patin bob at patin.com
Fri Jan 26 19:10:00 MST 2007


I came up for a fix for a query I was working on--not the one I asked  
about yesterday, but another one:

In this one, which is part of a shopping cart, any product can be  
placed in as many as 5 different categories. I wanted the user to be  
able to search by category, and when he clicked on a category, it'd  
display the proper items.

This worked fine until one of my clients started adding a ton of  
categories; in his case, he's selling jewelry, and so what I did was  
to take the 5 possible categories and store them in a calc field that  
conatined all 5, and then I'd search that. Worked fine for a while,  
until he had products with these categories:

Diamond Rings
Diamond studs
Diamond Bracelets
Slides and Bracelets

Well, he also had a category called "Diamond Bracelets," which as you  
can see wasn't part of the product above, so it shouldn't have found  
it... but it was. It was apparently finding the word "Diamond" and  
then the word "Bracelets," although they weren't together in the field.

So here's how I solved it, and I'm curious as to whether this was the  
best way: I did a search in category 1; if it had a foundCount <1, I  
did a 2nd search in category2, and so on until I'd searched all 5  
categories. In this way I didn't have to use the calc field with the  
concatenated categories in it. It works great, never pulls up the  
wrong products.

Anyone think of an easier way to do this sort of search? :)

Just curious,

Bob Patin
Longterm Solutions
bob at longtermsolutions.com
615-333-6858
http://www.longtermsolutions.com

   CONTACT US VIA INSTANT MESSAGING:
      AIM or iChat: longterm1954
      Yahoo: longterm_solutions
      MSN: tech at longtermsolutions.com
      ICQ: 159333060






More information about the FX.php_List mailing list