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 12d1a70b4495f95f8b1bc5e3de78e5c91a59bbe1..d11dd237146a035216b267a541135ac08bff3223 100644
--- a/module/VuFindSearch/src/VuFindSearch/Backend/Solr/Response/Json/Spellcheck.php
+++ b/module/VuFindSearch/src/VuFindSearch/Backend/Solr/Response/Json/Spellcheck.php
@@ -165,7 +165,7 @@ class Spellcheck implements IteratorAggregate, Countable
      *
      * @return bool
      */
-    protected function contains($term)
+    protected function contains(string $term)
     {
         if ($this->terms->offsetExists($term)) {
             return true;
diff --git a/module/VuFindSearch/tests/unit-tests/src/VuFindTest/Backend/Solr/Response/Json/SpellcheckTest.php b/module/VuFindSearch/tests/unit-tests/src/VuFindTest/Backend/Solr/Response/Json/SpellcheckTest.php
index ffc63f597bcfdffbec237cea4b81edab6a6142a1..4e7dcd3b3f8b56162039a0df84d74edd7e12bf5a 100644
--- a/module/VuFindSearch/tests/unit-tests/src/VuFindTest/Backend/Solr/Response/Json/SpellcheckTest.php
+++ b/module/VuFindSearch/tests/unit-tests/src/VuFindTest/Backend/Solr/Response/Json/SpellcheckTest.php
@@ -53,7 +53,8 @@ class SpellcheckTest extends TestCase
             [
                 ['this is a phrase', []],
                 ['foo', []],
-                ['foobar', []]
+                ['foobar', []],
+                ['1842', []],   // test numeric handling (can cause problems)
             ],
             'fake query'
         );
@@ -61,13 +62,27 @@ class SpellcheckTest extends TestCase
             [
                 ['is a', []],
                 ['bar', []],
-                ['foo bar', []]
+                ['foo bar', []],
+                ['1842', []],
+                ['1843', []]
             ],
             'fake query'
         );
         $s1->mergeWith($s2);
-        $this->assertCount(5, $s1);
+        $this->assertCount(7, $s1);
         $this->assertEquals($s2, $s1->getSecondary());
+        $this->assertEquals(
+            [
+                'this is a phrase' => [],
+                'foobar' => [],
+                'foo' => [],
+                'bar' => [],
+                'foo bar' => [],
+                '1842' => [],
+                '1843' => [],
+            ],
+            iterator_to_array($s1->getIterator())
+        );
     }
 
     /**