From 0b193eaa7aac82ecddbc2e29f5c2539fdaee8350 Mon Sep 17 00:00:00 2001 From: Ere Maijala <ere.maijala@helsinki.fi> Date: Thu, 27 Apr 2017 16:34:09 +0300 Subject: [PATCH] =?UTF-8?q?Added=20support=20for=20Solr=206.5=E2=80=99s=20?= =?UTF-8?q?suggestions=20JSON=20object=20format.=20(#960)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../VuFindSearch/Backend/Solr/Response/Json/Spellcheck.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/module/VuFindSearch/src/VuFindSearch/Backend/Solr/Response/Json/Spellcheck.php b/module/VuFindSearch/src/VuFindSearch/Backend/Solr/Response/Json/Spellcheck.php index a6d6bff7e77..0c34d883594 100644 --- a/module/VuFindSearch/src/VuFindSearch/Backend/Solr/Response/Json/Spellcheck.php +++ b/module/VuFindSearch/src/VuFindSearch/Backend/Solr/Response/Json/Spellcheck.php @@ -75,7 +75,9 @@ class Spellcheck implements IteratorAggregate, Countable public function __construct(array $spellcheck, $query) { $this->terms = new ArrayObject(); - $list = new NamedList($spellcheck); + // Solr 6.4 and before use an array of arrays with two elements, while + // from Solr 6.5 on the array is associative. + $list = isset($spellcheck[0]) ? new NamedList($spellcheck) : $spellcheck; foreach ($list as $term => $info) { if (is_array($info)) { $this->terms->offsetSet($term, $info); -- GitLab