Пример #1
0
function ftsearch_set_entries($object_type, $object_id, $cache_id, &$text, $last_modified)
{
    ftsearch_delete_entries($object_type, $object_id, $cache_id);
    $ahash = ftsearch_hash($text);
    foreach ($ahash as $k => $h) {
        sql("INSERT INTO `search_index` (`object_type`, `cache_id`, `hash`, `count`) VALUES ('&1', '&2', '&3', '&4') ON DUPLICATE KEY UPDATE `count`=`count`+1", $object_type, $cache_id, $h, 1);
    }
    sql("INSERT INTO `search_index_times` (`object_id`, `object_type`, `last_refresh`) VALUES ('&1', '&2', '&3') ON DUPLICATE KEY UPDATE `last_refresh`='&3'", $object_id, $object_type, $last_modified);
}
Пример #2
0
     sql_slave('ALTER TABLE &result_caches ADD PRIMARY KEY ( `cache_id` )');
     $sql_select[] = '&result_caches.`cache_id`';
     $sql_from = '&result_caches';
     $sql_innerjoin[] = '`caches` ON `caches`.`cache_id`=&result_caches.`cache_id`';
 } elseif ($options['searchtype'] == 'bycacheid') {
     $sql_select[] = '`caches`.`cache_id` `cache_id`';
     $sql_from = '`caches`';
     $sql_where[] = '`caches`.`cache_id`=\'' . sql_escape($options['cacheid']) . '\'';
 } elseif ($options['searchtype'] == 'bywp') {
     $sql_select[] = '`caches`.`cache_id` `cache_id`';
     $sql_from = '`caches`';
     $sql_where[] = '`caches`.`wp_oc`=\'' . sql_escape($options['wp']) . '\'';
 } elseif ($options['searchtype'] == 'byfulltext') {
     require_once $opt['rootpath'] . 'lib2/search/ftsearch.inc.php';
     $fulltext = $options['fulltext'];
     $hashes = ftsearch_hash($fulltext);
     if (count($hashes) == 0) {
         $options['error_nofulltext'] = true;
         outputSearchForm($options);
     } else {
         if (count($hashes) > 50) {
             $options['error_fulltexttoolong'] = true;
             outputSearchForm($options);
         }
     }
     $ft_types = array();
     if (isset($options['ft_name']) && $options['ft_name']) {
         $ft_types[] = 2;
     }
     if (isset($options['ft_logs']) && $options['ft_logs']) {
         $ft_types[] = 1;
Пример #3
0
function ftsearch_set_entries($object_type, $object_id, $cache_id, &$text, $last_modified)
{
    ftsearch_delete_entries($object_type, $object_id, $cache_id);
    $ahash = ftsearch_hash($text);
    foreach ($ahash as $k => $h) {
        XDb::xSql("INSERT DELAYED INTO `search_index` (`object_type`, `cache_id`, `hash`, `count`)\n            VALUES ( ?, ?, ?, ?)\n            ON DUPLICATE KEY UPDATE `count`=`count`+1", $object_type, $cache_id, $h, 1);
    }
    XDb::xSql("INSERT INTO `search_index_times` (`object_id`, `object_type`, `last_refresh`)\n        VALUES (?,?,?) ON DUPLICATE KEY UPDATE `last_refresh`= ? ", $object_id, $object_type, $last_modified, $last_modified);
}