From de4b5d89169610e5bda18688985790c592f2762d Mon Sep 17 00:00:00 2001 From: Mario Seidel Date: Thu, 23 Jan 2020 14:37:41 +0100 Subject: [PATCH] #65 add url to index if news type is external --- .../class.tx_mksearch_indexer_TxNewsNews.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/indexer/class.tx_mksearch_indexer_TxNewsNews.php b/indexer/class.tx_mksearch_indexer_TxNewsNews.php index 9d2c3585..326983c1 100644 --- a/indexer/class.tx_mksearch_indexer_TxNewsNews.php +++ b/indexer/class.tx_mksearch_indexer_TxNewsNews.php @@ -287,6 +287,8 @@ protected function indexNews( $indexDoc->addField('news_text_s', $bodyText, 'keyword'); $indexDoc->addField('news_text_t', $bodyText, 'keyword'); + $this->addExternalUrlToIndex($news, $indexDoc); + if ($news->getDatetime()) { $indexDoc->addField( 'datetime_dt', @@ -298,6 +300,23 @@ protected function indexNews( } } + /** + * Adds the external URL if news type is external. + * + * @param \GeorgRinger\News\Domain\Model\News $news + * @param tx_mksearch_interface_IndexerDocument $indexDoc + * + * @return void + */ + protected function addExternalUrlToIndex( + /* \GeorgRinger\News\Domain\Model\News */ $news, + tx_mksearch_interface_IndexerDocument $indexDoc + ) { + if (2 == $news->getType()) { + $indexDoc->addField('news_external_url_s', $news->getExternalurl()); + } + } + /** * Add tag data of the News to the index. *