# multiple search

My question could seem obvious but I don't find the solution.

How to make a search on two fields, like:

craft.entries.section('pages').search('foo:bar foo2:bar2')


I tried

search('foo:bar', 'foo2:bar4')
search('foo:bar and foo2:bar2')


none of these seem to work

Your search syntax of craft.entries.section('pages').search('foo:bar foo2:bar2') should work and is the equivalent of saying "give me all of the entries in the pages section where the field foo is equal to bar and the field foo2 is equal to bar2.
Something that trips people up often is that Craft doesn't do fuzzy searching by default. So foo:bar will match exactly bar, but it will not match bars. You'd need to use foo:bar* for that.