title: Grails: findAllByTitle() as a search function?
body: <p>I want to create a search for my Grails web application however I am having no luck in getting the results I want.  I'm currently using Grails 3.0.11, according to a post the searchable plugin is outdated but I couldn't get the elasticsearch plugin working either. I decided to try to use findAllByTitle("%test%"), I think it will work but I am not sure what I'm doing wrong. </p>
  
  <p>A certain Title is saved to a local database and when searched in my views I want it to display a list of Titles saved for example if i were to type in T it would display "Test1", "Test2", and "Test3".  I've also tried executeQuery() with no luck.</p>
  
  <p><strong>Title.groovy</strong></p>
  
  <pre><code>class Titles {
  
      byte[] branchImage
      String branchTitle
  
      static constraints = {
          branchImage(maxSize: 10 * 1024 * 1024)
      }
      static mapping = {
      }
  }
  </code></pre>
  
  <p><strong>TitleController.groovy</strong></p>
  
  <pre><code>class TitleController {
      def search(){
          def results = Title.findAllByBranchTitleIlike("%Test%")
          [results:results]
      }
  }
  </code></pre>
  
  <p><strong>main.gsp</strong></p>
  
  <pre><code>&lt;body&gt;
      &lt;div class="header-search"&gt;
      &lt;g:form action="search"&gt;
          &lt;g:textField name="search" class="search-field" value="search"/&gt;
              &lt;button type="submit" class="search-submit"&gt;&lt;i class="fa fa-search fa-lg"&gt;&lt;/i&gt;&lt;/button&gt;
      &lt;/g:form&gt;
      &lt;/div&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p><strong>search.gsp</strong></p>
  
  <pre><code>&lt;body&gt;
      &lt;g:each var="r" in="${results}"&gt;
          &lt;li&gt;${r.branchTitle}&lt;/li&gt;
      &lt;/g:each&gt;
  &lt;/body&gt;
  </code></pre>