title: Autocomplete using Solr & Spring - issue with multiple words
body: <p>I have indexed a database of locations using Spring Data Solr. I have the following fields:</p>
  
  <pre><code>   &lt;field name="id" type="string" indexed="true" stored="true" required="true" multiValued="false" /&gt; 
     &lt;field name="name" type="text_ws" indexed="true" stored="true"/&gt;
     &lt;field name="autocomplete" type="lowercase" indexed="true" stored="false"/&gt;
  </code></pre>
  
  <p>I am trying to implement an autocomplete feature. My ajax call is handled by a controller which calls a repository with:</p>
  
  <pre><code>List&lt;POISearch&gt; findByAutocompleteStartingWith(String autocomplete, Pageable pageable);
  </code></pre>
  
  <p>This works fine with a search like "California" or "Los". But when I try multiple words like "Los Ang" I get an exception:</p>
  
  <blockquote>
    <p>SEVERE: Servlet.service() for servlet [spring-mvc] in context with
    path [/xxx] threw exception [Request processing failed; nested
    exception is
    org.springframework.dao.InvalidDataAccessApiUsageException: Cannot
    constructQuery '<em>"los an"</em>'. Use epxression or mulitple clauses
    instead.] with root cause
    org.springframework.dao.InvalidDataAccessApiUsageException: Cannot
    constructQuery '<em>"los an"</em>'. Use epxression or mulitple clauses
    instead.  at
    org.springframework.data.solr.core.query.Criteria.assertNoBlankInWildcardedQuery(Criteria.java:596)
      at
    org.springframework.data.solr.core.query.Criteria.contains(Criteria.java:230)
      at
    org.springframework.data.solr.core.query.Criteria.contains(Criteria.java:257)
      at
    org.springframework.data.solr.core.query.Criteria.contains(Criteria.java:244)
      at
    org.springframework.data.solr.repository.query.SolrQueryCreator.from(SolrQueryCreator.java:112)
      at
    org.springframework.data.solr.repository.query.SolrQueryCreator.create(SolrQueryCreator.java:56)
      at
    org.springframework.data.solr.repository.query.SolrQueryCreator.create(SolrQueryCreator.java:43)
      at
    org.springframework.data.repository.query.parser.AbstractQueryCreator.createCriteria(AbstractQueryCreator.java:109)
      at
    org.springframework.data.repository.query.parser.AbstractQueryCreator.createQuery(AbstractQueryCreator.java:88)
      at
    org.springframework.data.repository.query.parser.AbstractQueryCreator.createQuery(AbstractQueryCreator.java:73)
      at
    org.springframework.data.solr.repository.query.PartTreeSolrQuery.createQuery(PartTreeSolrQuery.java:46)
      at
    org.springframework.data.solr.repository.query.AbstractSolrQuery.execute(AbstractSolrQuery.java:95)
      at
    org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:312)
      at
    org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
      at
    org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96)
      at
    org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260)
      at
    org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94)
      at
    org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
      at
    org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:155)
      at
    org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
      at
    org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
      at $Proxy44.findByAutocompleteContaining(Unknown Source)</p>
  </blockquote>
  
  <p>Any ideas how to solve?</p>