Skip to content
Snippets Groups Projects
Commit 0b193eaa authored by Ere Maijala's avatar Ere Maijala Committed by Demian Katz
Browse files

Added support for Solr 6.5’s suggestions JSON object format. (#960)

parent a5b9abca
No related merge requests found
......@@ -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);
......
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