Keval Domadia
Keval Domadia

Reputation: 4763

How to dynamically change query in using CakePHP Search Plugin?

Search plugin in working well but, I have to give either of conditions.

Example:

'name' => array('type' => 'like', 'encode' => true,
             'before' => false, 'after' => true,
                'wildcardAny' => '%', 'wildcardOne' => '_'),

Now.. When I set it to before false and after true, it searches for: keyword%

I want a condition that first search for all that is keyword% then, if there is a space it should do keyword-secondword% then search for keywordSecondword% then keyword%secondword% and finally if nothing is found then %secondkeyword and if still not found then %keyword%

Now, when I try to do:

if(empty($this->paginate))
{ // set query and Prg->common->process  }

It doesn't work!

I want heavy regex matching and stuff on controller and all the database heavy lifting by Models.

I have to search on the basis of priority.

Any ideas?

Upvotes: 0

Views: 328

Answers (0)

Related Questions