Skip to content

Commit

Permalink
#65 add url to index if news type is external
Browse files Browse the repository at this point in the history
  • Loading branch information
mario-seidel authored and hannesbochmann committed May 15, 2020
1 parent cdaf344 commit de4b5d8
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions indexer/class.tx_mksearch_indexer_TxNewsNews.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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.
*
Expand Down

0 comments on commit de4b5d8

Please sign in to comment.