Maybe try this:

$articles = $this->paginate('Article', array(
'conditions'=>array(
     'OR'=>array(
          'Article.name LIKE ' => '%' .$q .'%',
          'Tag.name LIKE ' => '%' .$q .'%'
          )
     )
));

On Jan 24, 4:54 pm, Paamayim <[email protected]> wrote:
> Hi.
>
> My search engine is as simple as a single text input box.
>
> Primarly my data consists of tagged articles. Tags are properly habtm
> relationed with articles, each Tag has an id and a name.
>
> Whenever an user search for a term, the search engine should look for
> Article.name OR related Tag names, and return the record if one of the
> conditions matches.
>
> Although I'm pretty new to Cake, I managed to do the Article.name part
> with something like this:
>
> $articles = $this->paginate('Article', array('Article.name LIKE \'' .
> $q . '\''));
>
> Where $q is my properly escaped search string.
>
> But for the Tags part, I'm pretty lost. Any advice on how could I add
> the condition?
>
> Thanks very much for any help.
--~--~---------~--~----~------------~-------~--~----~
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