Commit ea014752 authored by haydenyoung's avatar haydenyoung

Do not parse collation array for Solr 5+; values are already in name/value...

Do not parse collation array for Solr 5+; values are already in name/value pairs. Change unit test to match the collation data structure returned by Solr.
parent 095d41a8
......@@ -141,10 +141,18 @@ class Spellcheck extends ResponseParserAbstract implements ComponentParserInterf
if ($queryObject->getResponseWriter() == $queryObject::WT_JSON) {
if (is_array(current($values))) {
foreach ($values as $key => $value) {
$values[$key] = $this->convertToKeyValueArray($value);
if (array_key_exists('collationQuery', $value)) {
$values[$key] = $value;
} else {
$values[$key] = $this->convertToKeyValueArray($value);
}
}
} else {
$values = array($this->convertToKeyValueArray($values));
if (array_key_exists('collationQuery', $values)) {
$values = array($values);
} else {
$values = array($this->convertToKeyValueArray($values));
}
}
}
......
......@@ -194,12 +194,9 @@ class SpellcheckTest extends \PHPUnit_Framework_TestCase
'collations' => array(
'collation',
array(
0 => 'collationQuery',
1 => 'dell ultrasharp',
2 => 'hits',
3 => 0,
4 => 'misspellingsAndCorrections',
5 => array(
'collationQuery' => 'dell ultrasharp',
'hits' => 0,
'misspellingsAndCorrections' => array(
0 => 'delll',
1 => 'dell',
2 => 'ultrashar',
......@@ -208,12 +205,9 @@ class SpellcheckTest extends \PHPUnit_Framework_TestCase
),
'collation',
array(
0 => 'collationQuery',
1 => 'dell ultrasharp new',
2 => 'hits',
3 => 0,
4 => 'misspellingsAndCorrections',
5 => array(
'collationQuery' => 'dell ultrasharp new',
'hits' => 0,
'misspellingsAndCorrections' => array(
0 => 'delll',
1 => 'dell',
2 => 'ultrashar',
......
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