Ended up getting this working by assigning $this->paginate['conditions'] = 'MATCH( name, keywords, description, encoded ) AGAINST ( \'adwords\' )'; $this->paginate['fields'] = '*, MATCH( name, keywords, description, encoded ) AGAINST( \'adwords\' ) AS score ';
I had tried to do array_merge and push but I think it was assigning those to a next level; debugging would only bring back my 'limits' and 'recursive' keys and would print out an empty FeedContent array. Works well from what I see so far. Thanks for everyone's help On Mar 29, 9:47 pm, brian <[email protected]> wrote: > That should be: > > $paginate = array( > 'FeedContent' => array( > 'conditions' => 'CONDITIONS', > 'fields' => 'FIELDS' > ) > ); > > I don't know about using a key like 'Feed.FeedContent' but if it works ... > > But you said that you already had your global paginate array set up > fine, but you want it altered just for one method. In that case, you > just need to alter $this->paginate before calling $this->paginate() > (why are those named the same, anyway?) > > function your_action() > { > $this->paginate['FeedContent']['order'] = ... > $this->paginate['FeedContent']['conditions'] = ... > > Or use array_merge() if you need to change several things > > On Sun, Mar 29, 2009 at 10:04 PM, timtrice <[email protected]> wrote: > > > I did attempt that with something like: > > > $paginate = array( > > 'Feed.FeedContent', > > array( > > 'conditions' => 'CONDITIONS', > > 'fields' => 'FIELDS' > > ) > > ); > > > Obviously I had myc onditions and fields listed, but that generated an > > error as if it where trying to find a field named "conditions". > > > On Mar 29, 8:50 pm, brian <[email protected]> wrote: > >> You can modify $paginate temporarily from within a method. > > >> On Sun, Mar 29, 2009 at 9:38 PM, timtrice <[email protected]> wrote: > > >> > I have the following Find query to retrieve search results from my DB: > > >> > $this->set( > >> > 'results', > >> > $this->Feed->FeedContent->find( > >> > 'all', > >> > array( > >> > 'conditions' => 'MATCH( > >> > name, keywords, description, encoded ) > >> > AGAINST ( \'' . $keyword . '\')', > >> > 'fields' => '*, MATCH( > >> > name, keywords, description, encoded ) > >> > AGAINST( \'' . $keyword . '\' ) AS score ' > >> > ) > >> > ) > >> > ); > > >> > I'd like to paginate the results but I absolutely cannot find a way > >> > without generating errors. I can't alter my paginate array I > >> > immediately declared in my Controller because that array is also > >> > controlling other actions I have set up perfectly. I also do not want > >> > to throw this code into another model as I see it as way too much > >> > hassle to relate that Controller to the ones I have set up now. > > >> > Does anyone know about where I can find what I need to get this query > >> > paginated? I hate to have to write additional coding to do what > >> > hoepfully will be easier than it seems with Cake. > > >> > Thanks --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
