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

Reply via email to