Developer's Manual  Searching in SiteSupra Content Tables  How SiteSupra Stores Search Data

How SiteSupra Stores Search Data

SiteSupra stores the data you can later search for in the field search of the content table. SiteSupra updates the field with every save operation.

When saving a page SiteSupra looks for the state of the Search checkbox in the page properties. If the checkbox is selected, SiteSupra takes page title, short description, meta keywords, meta description, and values of block properties having parameter search set to one. Received string SiteSupra pass to the suGenerateSearch function shown below.

<?
function suGenerateSearch($search)
{
  
$toRemove = Array('.', ',', '!', '?', ':', ';', ')', '(', '"', '\'', "\n", "\r", "\t", '&nbsp;');
  
$search = str_replace($toRemove, ' ', $search);                                 // replace special symbols
  
$search = unhtmlentities($search);                                              // replace html-entities
  
$search = str_replace('>','> ', $search);                                       // add space after tags
  
$search = strip_tags($search);                                                  // strip html tags
  
$search = preg_replace('/ {2,}/', ' ', $search);                                // replace more than one space to one space
  
$search = sqllike($search);                                                     // make case-insensetive and accent-insensetive string
//$search = $lower($search);                                                      // or make case-sensetive string
  
$search = convert($search, $GLOBALS['suLANG']['langs'][suLANG]['code'], 'su');  // convert to internal "su" encoding
  
$search = str_replace('Bx', ' ', $search);                                      // replace space in "su" encoding to normal word delimiter
  
return $search;
}
?>
Please login to add comments.