boostPerField.put( bookFields[0], ( float ) 4 );
boostPerField.put( bookFields[1], ( float ) 3 );
boostPerField.put( bookFields[2], ( float ) 4 );
boostPerField.put( bookFields[3], ( float ) .5 );
FullTextEntityManager ftEm = org.hibernate.search.jpa.Search.getFullTextEntityManager( ( EntityManager ) em );
Analyzer customAnalyzer = ftEm.getSearchFactory().getAnalyzer( "customanalyzer" );
QueryParser parser = new MultiFieldQueryParser(
Version.LUCENE_29, bookFields,
customAnalyzer, boostPerField
);
org.apache.lucene.search.Query luceneQuery;
luceneQuery = parser.parse( searchQuery );
final FullTextQuery query = ftEm.createFullTextQuery( luceneQuery, Book.class );
return query;
}