title: Hibernate Search - How to list all records by default
body: <p>I am using Hibernate search.</p>
  
  <p>I have a search text box in my jsp page. If I enter some text, it returns correct result.
  But if I leave empty message and click the search button, it did not return any records.</p>
  
  <p><strong>Code:</strong></p>
  
  <pre><code>Session session = HibernateUtil.getSessionFactory().getCurrentSession();
  session.beginTransaction();
  
  String searchQuery = "Admin";
  String[] userFields = {"firstName", "lastName", "role_groupName", "userId"};
  QueryParser parser = new MultiFieldQueryParser(userFields, new StandardAnalyzer());
  org.apache.lucene.search.Query luceneQuery;
  try
  {
      luceneQuery = parser.parse(searchQuery);
  }
  catch (ParseException e) 
  {
      throw new RuntimeException("Unable to parse query: " + searchQuery, e);
  }
  
  FullTextSession ftSession = Search.getFullTextSession(session);
  org.hibernate.Query query = ftSession.createFullTextQuery(luceneQuery, UserVO.class);
  
  List results = query.list();
  System.out.println("Result size:" + results.size());    
  </code></pre>