private List buildRecords(InternalAggregations internalAgg, SearchHits topHits, KunderaQuery query,
            MetamodelImpl metaModel, Class clazz, EntityMetadata entityMetadata)
    {
        List temp = new ArrayList<>();

        Iterator<Expression> orderIterator = getSelectExpressionOrder(query).iterator();
        while (orderIterator.hasNext())
        {
            Expression exp = orderIterator.next();
            String text = exp.toActualText();
            String field = KunderaQueryUtils.isAggregatedExpression(exp) ? text.substring(
                    text.indexOf(ESConstants.DOT) + 1, text.indexOf(ESConstants.RIGHT_BRACKET)) : text.substring(
                    text.indexOf(ESConstants.DOT) + 1, text.length());

            temp.add(KunderaQueryUtils.isAggregatedExpression(exp) ? getAggregatedResult(internalAgg,
                    ((AggregateFunction) exp).getIdentifier(), exp) : getFirstResult(query, field, topHits, clazz,
                    metaModel, entityMetadata));
        }
        return temp;
    }
private List buildRecords ( InternalAggregations internalAgg , SearchHits topHits , KunderaQuery query , MetamodelImpl metaModel , Class clazz , EntityMetadata entityMetadata ) { List temp = new ArrayList < > ( ) ; Iterator < Expression > orderIterator = getSelectExpressionOrder ( query ) . iterator ( ) ; while ( orderIterator . hasNext ( ) ) { Expression exp = orderIterator . next ( ) ; String text = exp . toActualText ( ) ; String field = KunderaQueryUtils . isAggregatedExpression ( exp ) ? text . substring ( text . indexOf ( ESConstants . DOT ) + 1 , text . indexOf ( ESConstants . RIGHT_BRACKET ) ) : text . substring ( text . indexOf ( ESConstants . DOT ) + 1 , text . length ( ) ) ; temp . add ( KunderaQueryUtils . isAggregatedExpression ( exp ) ? getAggregatedResult ( internalAgg , ( ( AggregateFunction ) exp ) . getIdentifier ( ) , exp ) : getFirstResult ( query , field , topHits , clazz , metaModel , entityMetadata ) ) ; } return temp ; }
Parses the records.

@param internalAgg
the internal agg
@param topHits
the top hits
@param query
the query
@param metaModel
the meta model
@param clazz
the clazz
@param entityMetadata
the entity metadata
@return the list