Skip to content
Snippets Groups Projects
Commit 4422103e authored by Demian Katz's avatar Demian Katz
Browse files

Improved comments; simplified code.

parent 1d2d9608
No related merge requests found
...@@ -163,12 +163,6 @@ class Solr extends AbstractBase ...@@ -163,12 +163,6 @@ class Solr extends AbstractBase
foreach ($results->getRecords() as $current) { foreach ($results->getRecords() as $current) {
++$count; ++$count;
if ($sorting) {
$positions = $current->getHierarchyPositionsInParents();
if (isset($positions[$parentID])) {
$sequence = $positions[$parentID];
}
}
$titles = $current->getTitlesInHierarchy(); $titles = $current->getTitlesInHierarchy();
$title = isset($titles[$parentID]) $title = isset($titles[$parentID])
...@@ -185,9 +179,13 @@ class Solr extends AbstractBase ...@@ -185,9 +179,13 @@ class Solr extends AbstractBase
// If we're in sorting mode, we need to create key-value arrays; // If we're in sorting mode, we need to create key-value arrays;
// otherwise, we can just collect flat strings. // otherwise, we can just collect flat strings.
$xml[] = $sorting if ($sorting) {
? array(isset($sequence) ? $sequence : 0, $xmlNode) $positions = $current->getHierarchyPositionsInParents();
: $xmlNode; $sequence = isset($positions[$parentID]) ? $positions[$parentID] : 0;
$xml[] = array($sequence, $xmlNode);
} else {
$xml[] = $xmlNode;
}
} }
// Assemble the XML, sorting it first if necessary: // Assemble the XML, sorting it first if necessary:
...@@ -195,11 +193,12 @@ class Solr extends AbstractBase ...@@ -195,11 +193,12 @@ class Solr extends AbstractBase
} }
/** /**
* Sort Nodes * Convert an unsorted array of [ key, value ] pairs into a sorted array
* of values.
* *
* @param array $array The array to sort * @param array $array The array of arrays to sort
* *
* @return void * @return array
*/ */
protected function sortNodes($array) protected function sortNodes($array)
{ {
......
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