Example #1
0
        $countryCityName = @$countryCityName['name'];
    }
    if (!empty($filter["prof"]) && is_array($filter["prof"][1])) {
        $raw_professions = professions::GetProfessionsTitles(array_keys($filter["prof"][1]));
        $a_professions = array();
        foreach ($raw_professions as $profession_item) {
            $a_professions[$profession_item["name"]] = '(@name_prof "' . $profession_item["name"] . '" | @additional_specs "' . $profession_item["name"] . '")';
        }
        $string_professions = '(' . join(" | ", $a_professions) . ')';
    }
    $string_query = $search_string;
    // @todo Кажется, это никогда не используется?
    $string_query .= !empty($string_professions) ? ' ' . $string_professions : '';
    $type = 'users_ext';
    require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/search/search_ext.php";
    $search = new searchExt($uid);
    $search->setUserLimit(FRL_PP);
    $search->addElement($type, true, FRL_PP);
    $search->searchByType($type, $string_query, $page, $filter);
    $elements = $search->getElements();
    $element = $elements[$type];
    $frls = $element->results;
    $size = $element->total;
    $works = $element->works;
    $content = "search/content.php";
} else {
    $direction = (int) __paramInit('bool', 'dir', 'dir', false);
    $order = __paramInit('string', 'order', 'order', 'gnr');
    $catalog = new FreelancerCatalog();
    $catalog->initSearch($prof_group_id, $prof_id, $page, $order, $direction);
    if ($catalog->isFound()) {
Example #2
0
 /**
  * Поиск по всем пользователям через Sphinx.
  * 
  * @param type $count
  * @param bool $filter
  * @param type $page
  *
  * @return type
  */
 public function searchUsersBySphinx(&$count, $filter, $page = 1)
 {
     require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/search/search_ext.php';
     $string_query = trim(@$filter['search_name']);
     $search_name_exact = $filter['search_name_exact'] == 1;
     unset($filter['search_name'], $filter['search_name_exact']);
     $type = 'users_all';
     //Любое из слов
     if (!$search_name_exact) {
         $aKeyword = array();
         $aRequestString = preg_split('/[\\s,]+/', $string_query, 5);
         if ($aRequestString) {
             foreach ($aRequestString as $sValue) {
                 if (strlen($sValue) >= 3) {
                     $aKeyword[] .= '("' . $sValue . '" | "*' . $sValue . '*")';
                 }
             }
             if (!empty($aKeyword)) {
                 $string_query = implode(' | ', $aKeyword);
             }
         }
     }
     //Убираем пустые параметры фильра
     $filter = array_filter($filter);
     //Поиск Sphinx
     $search = new searchExt(get_uid(false));
     $search->setUserLimit($this->items_pp);
     $searchElement = $search->addElement($type, true, $this->items_pp);
     $searchElement->setMode($search_name_exact ? SPH_MATCH_ALL : SPH_MATCH_ANY);
     $search->searchByType($type, $string_query, $page, $filter);
     $elements = $search->getElements();
     $element = $elements[$type];
     $count = $element->total;
     return $element->results;
 }
Example #3
0
}
//------------------------------------------------------------------------------
$string_query = @$_GET['find'];
$string_query = iconv('UTF-8', 'CP1251', $string_query);
$host = @$_GET['host'];
$port = @$_GET['port'];
if (!$port) {
    $port = 3312;
}
//------------------------------------------------------------------------------
$types = array('works', 'messages', 'commune', 'notes', 'users_all', 'users_ext', 'users_simple', 'users', 'tservices');
define('ON_PAGE', 1);
$uid = 1;
$filter = null;
$page = 1;
$search = new searchExt($uid);
//$search->SetServer($CFG_META['sphinx']['host'], $CFG_META['sphinx']['port']);
$search->setUserLimit(ON_PAGE);
if ($types) {
    foreach ($types as $type) {
        $searchElement = $search->addElement($type, true, ON_PAGE);
        if ($host) {
            $searchElement->SetServer($host, $port);
        }
        $search->searchByType($type, $string_query, $page, $filter);
        $elements = $search->getElements();
        $element = $elements[$type];
        print_r("{$type}: {$element->total}" . PHP_EOL);
    }
}
exit;