Filter CMS Page Collection by Title or Content in Magento 1

cmscollection;magento-1

I'm working on a module to make certain CMS pages searchable on the front end. Right now I'm having a little trouble filtering the pages. I get the collection, filter it by an "is_searchable" field that I've added, which is working fine. When I try to filter it by title or content using a like statement, it either returns no results, or every result, regardless of if that matches the title/content at all or not. Here's what I'm using so far:

$results = Mage::getModel('cms/page')->getCollection()
               ->addFieldToFilter('title', array('like'=> '%' . $search . '%'))
               ->addFieldToFilter('content', array('like'=>'%' . $search . '%'))
               ->addFieldToFilter('is_searchable', 1);

I also tried using addAttributeToFilter() but get an error that that function doesn't exist in that model. Not sure what I'm doing wrong here, but any help or direction would be appreciated. Thanks!

Best Answer

The answer by @MauroNigrele comes close, but the actual syntax to combine several conditions for different fields with OR is different.

The following should work:

$results = Mage::getModel('cms/page')->getCollection()
    ->addFieldToFilter(
        ['title', 'content'],
        [['like' => "%{$search}%"], ['like' => "%{$search}%"]]
     )
     ->addFieldToFilter('is_searchable', 1);

You can find a more detailed documentation of addFieldToFilter() in this answer: addFilter vs addFieldToFilter