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 # CHANGELOG
## 3.6.0 ## 3.6.0 - 2016-05-03
- improvement: no longer allow failures for HHVM in continuous integration - improvement: no longer allow failures for HHVM in continuous integration
- improvement: added Symfony 3.x components to CI tests for PHP 5.5+ - improvement: added Symfony 3.x components to CI tests for PHP 5.5+
......
...@@ -72,7 +72,7 @@ class Client extends CoreClient ...@@ -72,7 +72,7 @@ class Client extends CoreClient
* *
* @var string * @var string
*/ */
const VERSION = '3.4.0'; const VERSION = '3.6.0';
/** /**
* Check for an exact version. * Check for an exact version.
......
...@@ -141,12 +141,20 @@ class Spellcheck extends ResponseParserAbstract implements ComponentParserInterf ...@@ -141,12 +141,20 @@ class Spellcheck extends ResponseParserAbstract implements ComponentParserInterf
if ($queryObject->getResponseWriter() == $queryObject::WT_JSON) { if ($queryObject->getResponseWriter() == $queryObject::WT_JSON) {
if (is_array(current($values))) { if (is_array(current($values))) {
foreach ($values as $key => $value) { foreach ($values as $key => $value) {
if (array_key_exists('collationQuery', $value)) {
$values[$key] = $value;
} else {
$values[$key] = $this->convertToKeyValueArray($value); $values[$key] = $this->convertToKeyValueArray($value);
} }
}
} else {
if (array_key_exists('collationQuery', $values)) {
$values = array($values);
} else { } else {
$values = array($this->convertToKeyValueArray($values)); $values = array($this->convertToKeyValueArray($values));
} }
} }
}
foreach ($values as $collationValue) { foreach ($values as $collationValue) {
$query = null; $query = null;
......
...@@ -194,12 +194,9 @@ class SpellcheckTest extends \PHPUnit_Framework_TestCase ...@@ -194,12 +194,9 @@ class SpellcheckTest extends \PHPUnit_Framework_TestCase
'collations' => array( 'collations' => array(
'collation', 'collation',
array( array(
0 => 'collationQuery', 'collationQuery' => 'dell ultrasharp',
1 => 'dell ultrasharp', 'hits' => 0,
2 => 'hits', 'misspellingsAndCorrections' => array(
3 => 0,
4 => 'misspellingsAndCorrections',
5 => array(
0 => 'delll', 0 => 'delll',
1 => 'dell', 1 => 'dell',
2 => 'ultrashar', 2 => 'ultrashar',
...@@ -208,12 +205,9 @@ class SpellcheckTest extends \PHPUnit_Framework_TestCase ...@@ -208,12 +205,9 @@ class SpellcheckTest extends \PHPUnit_Framework_TestCase
), ),
'collation', 'collation',
array( array(
0 => 'collationQuery', 'collationQuery' => 'dell ultrasharp new',
1 => 'dell ultrasharp new', 'hits' => 0,
2 => 'hits', 'misspellingsAndCorrections' => array(
3 => 0,
4 => 'misspellingsAndCorrections',
5 => array(
0 => 'delll', 0 => 'delll',
1 => 'dell', 1 => 'dell',
2 => 'ultrashar', 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