Commit 82064281 authored by chadicus's avatar chadicus

Remove yet another level of indentation in Grouping::parse()

parent 83d953ba
...@@ -73,39 +73,41 @@ class Grouping implements ComponentParserInterface ...@@ -73,39 +73,41 @@ class Grouping implements ComponentParserInterface
// check grouping fields as well as the grouping function (either can be used in the query) // check grouping fields as well as the grouping function (either can be used in the query)
foreach (array_merge($grouping->getFields(), array($grouping->getFunction())) as $field) { foreach (array_merge($grouping->getFields(), array($grouping->getFunction())) as $field) {
if (isset($data['grouped'][$field])) { if (!isset($data['grouped'][$field])) {
$result = $data['grouped'][$field]; continue;
}
$matches = (isset($result['matches'])) ? $result['matches'] : null; $result = $data['grouped'][$field];
$groupCount = (isset($result['ngroups'])) ? $result['ngroups'] : null;
$valueGroups = array(); $matches = (isset($result['matches'])) ? $result['matches'] : null;
foreach ($result['groups'] as $valueGroupResult) { $groupCount = (isset($result['ngroups'])) ? $result['ngroups'] : null;
$value = (isset($valueGroupResult['groupValue'])) ? $valueGroups = array();
$valueGroupResult['groupValue'] : null; foreach ($result['groups'] as $valueGroupResult) {
$value = (isset($valueGroupResult['groupValue'])) ?
$numFound = (isset($valueGroupResult['doclist']['numFound'])) ? $valueGroupResult['groupValue'] : null;
$valueGroupResult['doclist']['numFound'] : null;
$numFound = (isset($valueGroupResult['doclist']['numFound'])) ?
$start = (isset($valueGroupResult['doclist']['start'])) ? $valueGroupResult['doclist']['numFound'] : null;
$valueGroupResult['doclist']['start'] : null;
$start = (isset($valueGroupResult['doclist']['start'])) ?
$maxScore = (isset($valueGroupResult['doclist']['maxScore'])) ? $valueGroupResult['doclist']['start'] : null;
$valueGroupResult['doclist']['maxScore'] : null;
// create document instances
$documents = array();
if (isset($valueGroupResult['doclist']['docs']) &&
is_array($valueGroupResult['doclist']['docs'])) {
foreach ($valueGroupResult['doclist']['docs'] as $doc) {
$documents[] = new $documentClass($doc);
}
}
$valueGroups[] = new $valueResultClass($value, $numFound, $start, $documents, $maxScore, $query); $maxScore = (isset($valueGroupResult['doclist']['maxScore'])) ?
$valueGroupResult['doclist']['maxScore'] : null;
// create document instances
$documents = array();
if (isset($valueGroupResult['doclist']['docs']) &&
is_array($valueGroupResult['doclist']['docs'])) {
foreach ($valueGroupResult['doclist']['docs'] as $doc) {
$documents[] = new $documentClass($doc);
}
} }
$groups[$field] = new FieldGroup($matches, $groupCount, $valueGroups); $valueGroups[] = new $valueResultClass($value, $numFound, $start, $documents, $maxScore, $query);
} }
$groups[$field] = new FieldGroup($matches, $groupCount, $valueGroups);
} }
// parse query groups // parse query groups
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment