From db626cb8270fb5ff7e5edf46e090d70e0f5c3518 Mon Sep 17 00:00:00 2001 From: Jun Kim Date: Thu, 21 Feb 2019 15:42:29 -0500 Subject: [PATCH] regex fix for html tags in title --- classes/AlgoliaService.inc.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/classes/AlgoliaService.inc.php b/classes/AlgoliaService.inc.php index 1984f14..6af5f9c 100644 --- a/classes/AlgoliaService.inc.php +++ b/classes/AlgoliaService.inc.php @@ -364,7 +364,7 @@ function mapAlgoliaFieldsToIndex($article){ foreach($fieldsToIndex as $field){ switch($field){ case "title": - $mappedFields[$field] = $article->getTitle(null); + $mappedFields[$field] = $this->formatTitle($article); break; case "abstract": @@ -525,4 +525,10 @@ function chunkContent($content){ return $data; } + + function formatTitle($article){ + $title = $article->getTitle(null); + + return preg_replace("/<.*?>/", "", $title); + } } \ No newline at end of file