summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Brahmer <info@b-brahmer.de>2022-08-06 11:29:46 +0200
committerBenjamin Brahmer <info@b-brahmer.de>2022-08-19 09:14:27 +0200
commita66d62d1d70932efb7ac4871882974e528f1e139 (patch)
tree51a1a69556bcba264ea1c50a74f4fd52b41fc33e
parent51e6928a469128315b109e4a608860c2fd2ea4c3 (diff)
adapt generateSearchIndex
Signed-off-by: Benjamin Brahmer <info@b-brahmer.de>
-rw-r--r--lib/Db/Item.php32
1 files changed, 22 insertions, 10 deletions
diff --git a/lib/Db/Item.php b/lib/Db/Item.php
index b30bd31cf..4fe9bc19c 100644
--- a/lib/Db/Item.php
+++ b/lib/Db/Item.php
@@ -170,16 +170,28 @@ class Item extends Entity implements IAPI, \JsonSerializable
? implode('', $this->getCategories())
: '';
- $this->setSearchIndex(
- mb_strtolower(
- html_entity_decode(strip_tags($this->getBody())) .
- html_entity_decode($this->getAuthor()) .
- html_entity_decode($this->getTitle()) .
- html_entity_decode($categoriesString) .
- $this->getUrl(),
- 'UTF-8'
- )
- );
+ if (!is_null($this->getBody())) {
+ $stripedBody = strip_tags($this->getBody());
+ } else {
+ $stripedBody = "";
+ }
+
+ $input_list = array($stripedBody, $this->getAuthor(), $this->getTitle(), $categoriesString);
+
+ $search_string = "";
+
+ foreach ($input_list as $value) {
+ if (is_null($value)){
+ $search_string .= "";
+ } else {
+ html_entity_decode($value);
+ }
+ }
+
+ $search_string .= $this->getUrl();
+ $search_string .= 'UTF-8';
+
+ $this->setSearchIndex(mb_strtolower($search_string));
$this->setFingerprint($this->computeFingerprint());
$this->setContentHash($this->computeContentHash());
}