I never understood the need for a "all" field
you can achieve it by using MultiFieldQueryParser, plus MultiFieldQueryParser has the benefit of supporting per field boosting which I found very useful in most multi field usecases.
Here is an example (first part of it)
Code:
private static String[] productFields = {"title",
"description", "actors.name", "categories.name"};
private Query searchQuery(String searchQuery)
{
//lucene part
Map<String,Float> boostPerField = new HashMap<String,Float>(4);
boostPerField.put( "title", (float) 4);
boostPerField.put( "description", (float) 2);
boostPerField.put( "actors.name", (float) 2);
boostPerField.put( "categories.name", (float) .5);
QueryParser parser = new MultiFieldQueryParser(productFields, new StandardAnalyzer(), boostPerField);
org.apache.lucene.search.Query luceneQuery;
try
{
luceneQuery = parser.parse(searchQuery);
}
catch (ParseException e)
{
//do something here
throw new RuntimeException("Unable to parse query: " + searchQuery, e);
}
//Hibernate Search
FullTextSession ftSession =
org.hibernate.search.Search.createFullTextSession(
(Session) em.getDelegate() );
return ftSession.createFullTextQuery(luceneQuery, Product.class);