public static Object[] getDocumentFields(SearchFactoryImplementor searchFactoryImplementor, Class<?> clazz, Document document, String[] fields) {
DocumentBuilderIndexedEntity<?> builderIndexedEntity = searchFactoryImplementor.getDocumentBuilderIndexedEntity(
clazz
);
if ( builderIndexedEntity == null ) {
throw new SearchException( "No Lucene configuration set up for: " + clazz.getName() );
}
final int fieldNbr = fields.length;
Object[] result = new Object[fieldNbr];
ContextualException2WayBridge contextualBridge = new ContextualException2WayBridge();
contextualBridge.setClass( clazz );