Keyword Search

How can I exclude 'Timeline' from keyword search results? Also, where can I change the layout of the keyword search results page?

  • 533
  • More
Replies (12)
    • Hello Scholar !

      You may set the value of the "GlobalSearch" field for the Timeline records as 0 in the table `sys_objects_search`. As the search keyword page shows only the containers of found search results from the necessary app you may edit only the method getResultsContainer form the BxTemplSearch class.

      • 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'

                      );

              • How to disable _sys_pages (Pages) search. Thx.

                • Hide from search mean. 

                  • Any suggestion please. 

                    • Hello Rocco !

                      The simplest way is to add the RAW block on the necessary page with the following code:

                      <script>

                        $( document ).ready(function() {

                        $("input[name=keyword]").parent().remove();

                      });

                      </script>

                      In this case, you will have the possibility to launch this code for the necessary permission levels.

                      • I need to hide search by homepage and hide pages result! How do it. Plz. 

                        • UNA 12 provides the possibility to hide the searchKeyword.php page for certain permissions levels.

                          • Do i can hide pages block from search result and from search category? THx

                            Login or Join to comment.