Commit 926e0b59 authored by Bas de Nooijer's avatar Bas de Nooijer Committed by GitHub

Merge pull request #439 from haydenyoung/#426

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.
parents b085cc11 e2063db2
# CHANGELOG
## 3.6.0
## 3.6.0 - 2016-05-03
- improvement: no longer allow failures for HHVM in continuous integration
- improvement: added Symfony 3.x components to CI tests for PHP 5.5+
......
......@@ -72,7 +72,7 @@ class Client extends CoreClient
*
* @var string
*/
const VERSION = '3.4.0';
const VERSION = '3.6.0';
/**
* Check for an exact version.
......
......@@ -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