Comment to 'Keyword Search'
Comment to Keyword Search
  • Thanks LeonidS . Unfortunately, changing "GlobalSearch" does not make any change on the search reasults. Actually, even removing the whole record of the timeline from sys_objects_search table doe not exclude Timeline from search.
    here is the code of the method getResultsContainer:
    public function getResultsContainer($sCode = '')
    {        
    $sIdResults = $this->_sIdResults . ($this->_bLiveSearch ? $this->_sSuffixLiveSearch : '');
    return '<div id="' . $sIdResults . '">' . $sCode . '</div>';
    }

    How can I edit this code to exclude Timeline (or to enumerate specific modules for search)?

    • No, then you'd better redeclare the method getKeyTitlesPairs in the BxTemplSearch class of your template. It should have a look like:

      private function getKeyTitlesPairs ()

          {

              $a = array();

              foreach ($this->aClasses as $sKey => $r)

      if ($sKey == 'bx_timeline' || $sKey == 'bx_timeline_cmts')

      continue;

                  if ($this->_sMetaType || $r['GlobalSearch'])

                      $a[$sKey] = _t($r['title']);

              return $a;

          }

      The bold part is the addon to exclude Timeline and Timeline comments form the search keyword form.

      • No, then you'd better redeclare the method getKeyTitlesPairs in the BxTemplSearch class of your template. It should have a look like:

        private function getKeyTitlesPairs ()

            {

                $a = array();

                foreach ($this->aClasses as $sKey => $r)

        if ($sKey == 'bx_timeline' || $sKey == 'bx_timeline_cmts')

        continue;

                    if ($this->_sMetaType || $r['GlobalSearch'])

                        $a[$sKey] = _t($r['title']);

                return $a;

            }

        The bold part is the addon to exclude Timeline and Timeline comments form the search keyword form.

        Thanks LeonidS . getKeyTitlesPairs () changes the list of options/vlaues appearing under 'Section' of the search form only, but does not exclude timeline from search results when the 'global search' / 'select all' option is chosen. it sounds that we need to do something with the public function getForm() with BxBaseSearch class. any ideas?

        • Then you need to exclude Timeline in this part of response method

          if (!$this->_sMetaType && !$aValue['GlobalSearch'])

                          continue;

          or directly in the __construct in this part:

          $this->aClasses = BxDolDb::getInstance()->fromCache('sys_objects_search', 'getAllWithKey',

                     'SELECT `ID` as `id`,

                             `Title` as `title`,

                             `ClassName` as `class`,

                             `ClassPath` as `file`,

                             `ObjectName`,

                             `GlobalSearch`

                      FROM `sys_objects_search`

                      ORDER BY `Order` ASC', 'ObjectName'

                  );