Sunday, January 22, 2012

Re: CakeDC Search Plugin - How to search 2 fields in DB using only 1 form field?

Thanks so much Euromark, just tried it and worked perfectly.

Andrew

On Jan 22, 10:51 am, euromark <dereurom...@googlemail.com> wrote:
> with my bugfixed and enhanced version you can:https://github.com/dereuromark/search
>
> but you should use an array structure then - like that:
>
>   'field'=>array('Model1.entry1', 'Model1.entry2',
> 'Model2.entry2', ...)
>
> On 22 Jan., 19:46, andrewperk <andrewp...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Hello,
>
> > I'm using the CakeDC search plugin.
>
> > How can I search with a Like query in two different fields in the
> > database using just one form field?
>
> > For instance, a user goes to the form, enters in their search term,
> > this term will be checked if there's a Like query match in both the
> > entry1 field or the entry2 field.
>
> > I was trying this in the model:
>
> > public $filterArgs = array(
> >     array(
> >         'name'=>'entry1',
> >         'type'=>'like',
> >         'field'=>'Model.entry1 OR Model.entry2')
> > );
>
> > But this only seems to search from the last Model.entry2 field, it
> > doesn't search in entry1. I see the query search type, but I'm unclear
> > how to go about constructing it properly.
>
> > Thanks for any help.

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: