title: lucene search is not working
body: <p>I am using Lucene for my user search. For indexing i have the following code</p>
  
  <pre><code>private void internalAddUser(User user) throws IOException {
      Document document = new Document();
      document.add(new Field("login", user.getLogin(), Field.Store.YES, Field.Index.NOT_ANALYZED));
      document.add(new Field("firstName", user.getFirstName(), Field.Store.YES, Field.Index.NOT_ANALYZED));
      document.add(new Field("lastName", user.getLastName(), Field.Store.YES, Field.Index.NOT_ANALYZED));
      userIndexWriter.addDocument(document);
  }
  </code></pre>
  
  <p>and for search I use the following code but i am not getting any results.</p>
  
  <pre><code>@Override
  @Cacheable("user-prefix-cache")
  public Collection&lt;String&gt; searchUserByPrefix(String prefix) {
      IndexSearcher searcher = null;
      List&lt;String&gt; logins = new ArrayList&lt;String&gt;();
      try {
          searcher = userSearcherManager.acquire();
  
          BooleanQuery booleanQuery = new BooleanQuery();
  
          Query query1 = new TermQuery(new Term("login", prefix));
          Query query2 = new TermQuery(new Term("firstName", prefix));
          Query query3 = new TermQuery(new Term("lastName", prefix));
  
          booleanQuery.add(query1, BooleanClause.Occur.SHOULD);
          booleanQuery.add(query2, BooleanClause.Occur.SHOULD);
          booleanQuery.add(query3, BooleanClause.Occur.SHOULD);
  
          SortField sortField = new SortField("login", SortField.STRING, true);
          Sort sort = new Sort(sortField);
  
          TopDocs topDocs = searcher.search(booleanQuery, DEFAULT_TOP_N_SEARCH_USER, sort);
          int totalHits = topDocs.totalHits;
          if (totalHits == 0) {
              return new ArrayList&lt;String&gt;();
          }
  
          ScoreDoc[] scoreDocArray = topDocs.scoreDocs;
          for (int i = 0; i &lt; scoreDocArray.length; i++) {
              int documentId = scoreDocArray[i].doc;
              Document document = searcher.doc(documentId);
              logins.add(document.get("login"));
          }
      } catch (IOException e) {
          log.error("A Lucene query had a I/O error : " + e.getMessage());
          if (log.isDebugEnabled()) {
              e.printStackTrace();
          }
      } finally {
          try {
              userSearcherManager.release(searcher);
          } catch (IOException e) {
              log.error("The Lucene searcher could not be given back to the searcherManager pool. " +
                      e.getMessage());
  
              if (log.isDebugEnabled()) {
                  e.printStackTrace();
              }
          }
      }
      return logins;
  }
  </code></pre>
  
  <p>I am not a lucene expect but i am not sure why it is not working. Does anybody have any idea.</p>
  
  <pre><code>[DEBUG] in.daydiary.web.rest.SearchController - REST request to find users starting with : j
  [DEBUG] in.daydiary.web.rest.SearchController - REST request to find users starting with : j
  [DEBUG] in.daydiary.web.rest.SearchController - REST request to find users starting with : ju
  [DEBUG] in.daydiary.web.rest.SearchController - REST request to find users starting with : jul
  [DEBUG] in.daydiary.web.rest.SearchController - REST request to find users starting with : juli
  [DEBUG] in.daydiary.web.rest.SearchController - REST request to find users starting with : julia
  [DEBUG] in.daydiary.web.rest.SearchController - REST request to find users starting with : julianb
  [DEBUG] in.daydiary.web.rest.SearchController - REST request to find users starting with : julianb
  [DEBUG] in.daydiary.web.rest.SearchController - REST request to find users starting with : julian
  [DEBUG] in.daydiary.web.rest.SearchController - REST request to find users starting with : julia
  [DEBUG] in.daydiary.web.rest.SearchController - REST request to find users starting with : juli
  [DEBUG] in.daydiary.web.rest.SearchController - REST request to find users starting with : jul
  [DEBUG] in.daydiary.web.rest.SearchController - REST request to find users starting with : ju
  [DEBUG] in.daydiary.web.rest.SearchController - REST request to find users starting with : j
  </code></pre>