title: CakePHP find query using %like%
body: <p>I have the following find query for my CakePHP app:</p>
  
  <pre><code>$this-&gt;paginate = array(
  'limit'=&gt;5,
  'order'=&gt;'Note.datetime DESC',
  'conditions' =&gt; array(
      'Note.status'=&gt;1,
      'OR' =&gt; array(
          'Note.title LIKE' =&gt; '%'. $q . '%',
          'Note.content LIKE' =&gt; '%'. $q . '%'
          )
      )
  );
  </code></pre>
  
  <p>Which takes a parameter called <code>$q</code> to do like query on both title and content.</p>
  
  <p>So for example if I have the following:</p>
  
  <p><code>Title: Lorem ipsum</code>
  <code>Content: Lorem ipsum dolare</code></p>
  
  <p>And search for <code>'lorem'</code></p>
  
  <p>It would find it fine. But if I search for <code>'lorem dolare'</code> it won't find it.</p>
  
  <p>How do I do that?</p>
  
  <p>Note: I don't want to use any plugins etc.</p>
  
  <p>EDIT: If I use FULLTEXT would this work?</p>
  
  <pre><code>$this-&gt;paginate = array(
  'limit'=&gt;5,
  'order'=&gt;'Note.datetime DESC',
  'conditions' =&gt; array(
      'Note.status'=&gt;1,
      'OR' =&gt; array(
          'MATCH(Note.title) AGAINST('.$q.' IN BOOLEAN MODE)',
          'MATCH(Note.content) AGAINST('.$q.' IN BOOLEAN MODE)'
          )
      )
  );
  </code></pre>
  
  <p>EDIT 2:</p>
  
  <p>Getting this error trying the above:</p>
  
  <pre><code> Error: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'dolor IN BOOLEAN MODE)) OR (MATCH(`Note`.`content`) AGAINST(lorem dolor IN BOOLE' at line 1
  
  SQL Query: SELECT `Note`.`id`, `Note`.`title`, `Note`.`excerpt`, `Note`.`content`, `Note`.`datetime`, `Note`.`user_id`, `Note`.`slug`, `Note`.`status`, `Note`.`topic_id`, `User`.`id`, `User`.`email`, `User`.`firstname`, `User`.`lastname`, `User`.`password`, `User`.`status`, `Topic`.`id`, `Topic`.`title`, `Topic`.`slug` FROM `db52704_driz2013`.`notes` AS `Note` LEFT JOIN `db52704_driz2013`.`users` AS `User` ON (`Note`.`user_id` = `User`.`id`) LEFT JOIN `db52704_driz2013`.`topics` AS `Topic` ON (`Note`.`topic_id` = `Topic`.`id`) WHERE `Note`.`status` = 1 AND ((MATCH(`Note`.`title`) AGAINST(lorem dolor IN BOOLEAN MODE)) OR (MATCH(`Note`.`content`) AGAINST(lorem dolor IN BOOLEAN MODE))) ORDER BY `Note`.`datetime` DESC LIMIT 5 
  </code></pre>