<![CDATA[ Highlighting words only in search results ? - MODX Community Forums]]> https://forums.modx.com/thread/?thread=97762 <![CDATA[Highlighting words only in search results ?]]> https://forums.modx.com/thread/97762/highlighting-words-only-in-search-results#dis-post-528677
Is there a way to make the "Highlight Search" plugin highlighting words only in the search results but not in the linked pages?

When having &highlightResult=`1`, the matching words in both AjaxSearch results and linked pages are highlighted.

Jul Jul 21, 2015, 12:56 PM https://forums.modx.com/thread/97762/highlighting-words-only-in-search-results#dis-post-528677
<![CDATA[Re: Highlighting words only in search results ? (Best Answer)]]> https://forums.modx.com/thread/97762/highlighting-words-only-in-search-results#dis-post-529633 Solution:

In the file assets/snippets/ajaxSearch/classes/ajaxSearchOutput.class.inc.php :

  1. Comment out the if {} else {} sandwich starting at line 741.
  2. Add the line 748, just below the code you commented out.

       /* Disabled : highlighting in linked ressources
        if ($this->asCfg->cfg['highlightResult'] && $hClass) {
            $resultLink = $modx->makeUrl($row[$id], '', 'searched=' . urlencode($this->asCtrl->searchString) . '&advsearch=' . urlencode($this->asCtrl->advSearch) . '&highlight=' . urlencode($hClass));
        } else {
            $resultLink = $modx->makeUrl($row[$id]);
        $resultLink = $modx->makeUrl($row[$id]);

AjaxSearch will link the matching pages, but without the parameters in URLs that were doing the highlighting in linked pages.]]>
Jul Aug 07, 2015, 07:36 AM https://forums.modx.com/thread/97762/highlighting-words-only-in-search-results#dis-post-529633