title: Split a string and search a domain for each individual word with Grails and Groovy
body: <p>I'm creating a search function to browse through one of my domain classes.</p>
  
  <p>I have a string which i would like to split into individual words, so that I can search through my domain class for each word.</p>
  
  <p>For example, my User class has a name attribute and a biography attribute. 
  If I searched <strong>"Tom Chicago"</strong> in my system, it would return all the users with a name like <strong>%tom%</strong> or with a name like <strong>%chicago%</strong> AND all the users with a biography containing either of those words to.</p>
  
  <p>I have started my search function like this:</p>
  
  <pre><code>def userCriteria = User.createCriteria()
  userResults = userCriteria.list(){
      like("name", "%${q}%")
      like("biography", "%${q}%")
  }  
  </code></pre>
  
  <p>Obviously this is not doing quite what I'd like it to do. How can I adjust it so that it does?</p>