]> BookStack Code Mirror - bookstack/blobdiff - app/Search/SearchIndex.php
Search: Updated indexer to handle non-breaking-spaces
[bookstack] / app / Search / SearchIndex.php
index 36f71f6ccc7759cd09d3de29e8464a187c1507a6..844e3584b209cd49442d91066e535f4d66e293e4 100644 (file)
@@ -160,7 +160,9 @@ class SearchIndex
         /** @var DOMNode $child */
         foreach ($doc->getBodyChildren() as $child) {
             $nodeName = $child->nodeName;
-            $termCounts = $this->textToTermCountMap(trim($child->textContent));
+            $text = trim($child->textContent);
+            $text = str_replace("\u{00A0}", ' ', $text);
+            $termCounts = $this->textToTermCountMap($text);
             foreach ($termCounts as $term => $count) {
                 $scoreChange = $count * ($elementScoreAdjustmentMap[$nodeName] ?? 1);
                 $scoresByTerm[$term] = ($scoresByTerm[$term] ?? 0) + $scoreChange;