Search through multiple custom attributes?

Permalink
Hi,

just wondering how to ge the search providing results when searching for different custom attributes?

I added several custom attributes to my pages like "Address" and "Industry". Searching for "Munic Cardealer" results nothing, but there's a page with these values set in their custom attributes.

How to approach this issue?

sk01
 
sk01 replied on at Permalink Reply
sk01
Hi Folks,

I solved this problem now and want to publish my code as it might be usefull to others.

I changed blocks/search/controller.php so it now takes more than one word in the search query and it checks for double results. Source has comments.

have fun:

<?php 
defined('C5_EXECUTE') or die("Access Denied.");
class SearchBlockController extends BlockController {
   protected $btTable = 'btSearch';
   protected $btInterfaceWidth = "400";
   protected $btInterfaceHeight = "170";
   public $title = "";
   public $buttonText = ">"; 
   public $baseSearchPath = "";
   public $resultsURL = "";
   protected $hColor = '#EFE795';
   public function highlightedMarkup($fulltext, $highlight) {
      $this->hText = $fulltext;
      $this->hHighlight  = str_replace(array('"',"'","""),'',$highlight); // strip the quotes as they mess the regex
      $this->hText = @preg_replace( "#$this->hHighlight#i", '<span style="background-color:'. $this->hColor .';">$0</span>', $this->hText );

This website stores cookies on your computer. These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media. To find out more about the cookies we use, see our Privacy Policy.