I do not have the option of multiple fields. Im not making google search or anything but just a simple quick search => field is all I want. Just a simple type something in here, spit out results
Sure I could put state / country / title descriptions / date and make a form as long as the page but this is a nice clean site being built and a giant ugly form with a dropdown select country with all how many hundred countries there are in the database having to load that code everypage (sure the query is cached, but load time on all that extra code <option>[country]</option> couple hundred times) and as I mentioned I need 1 field. Imagine a search field in the header, quick search with 6 fields. Not so quick if you have to fill that out, and that would be extremely ugly in the header........lol. As for time it is faster in response time just testing it than standard pagination query so that's fine with me. 1 additional query is not a lot to worry about I would think. The query with 10 terms and 1 country is 28ms thur the db on a server on the web , not my local machine so if it was up in the 100's of ms sure find a different way I agree. 1 form with 1 field doing 2 queries vs 1 form with 5 or 6 fields in the header quick search I think not. So maybe from a programming point it may not be the correct solution but it is the best option, and from a front end look it is also. Dave -----Original Message----- From: John Andersen [mailto:[email protected]] Sent: November-19-10 3:33 PM To: CakePHP Subject: Re: Search multiple Tables The problem is that it is impossible to say whether a search term is a country or not, so you will have to not only do the normal search, but before that you will have to search the country table for any countries that matches the search terms. If any matches, you will have to include the returned ids in the normal search condition. Should you have other related tables, that you would like to include in the search, you will have to also make one additional search for each of them and then include the returned ids in the normal search condition. The above will make your solution very slow I think :) Another solution would be to allow the users to choose one or more countries as an additional parameter in your search form, thus you at once know the country ids to include in your search. Enjoy, John On 18 Nov., 01:05, "Dave Maharaj" <[email protected]> wrote: > I am in need of a search function and I have found the CakeDC plugin and a > few other how to articles, but my problem with the DC plugin which seems the > best is that I have 1 field => search so user can enter in anything and then > search multiple tables for that data. > > Where I seem to be stumped is someone enters "china" as a search term the > data / records associated with "china" would be country_id => 56 not "china" > so I would have to first find from Country where name LIKE $term to get the > id then pass that to the search right? > > And the search field can accept multiple terms so it could be anything > china, toys, spaghetti, bikinins. Finding records where im simply checking > the Post.description for $terms is fine and easy enough, it's the relation > _id's where I seem to be stumped. > > Any insight or what you may have done / would do would be great. > > Thanks, > > Dave Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
