0

Within my cakephp 2.3 app I have a one field search at the top of each page. I want this contents of this field to be used to search accross muliple fields. How can I do this?

For example

User searchs for "Error 324" and the search plugin searches the following db fields for that string - article.title, article.error, article.environment and returns any records with the search string within those fields.

I've read the github docs at https://github.com/CakeDC/search and think I need to do soemthing like their OR condition example but am struggling really - could someone point me in the rigt direction?

Thanks

Jimothey
  • 2,414
  • 9
  • 41
  • 66

1 Answers1

1

You did see that there is a readme containing pretty much exactly this scenario?

'username' => array('type' => 'like', 'field' => array('User.username', 'UserInfo.first_name')),

so in your case its just

'field' => array('Article.error', 'Article.title', 'Article.environment', ...)
mark
  • 21,691
  • 3
  • 49
  • 71