當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CSearch::loadIndex方法代碼示例

本文整理匯總了PHP中CSearch::loadIndex方法的典型用法代碼示例。如果您正苦於以下問題:PHP CSearch::loadIndex方法的具體用法?PHP CSearch::loadIndex怎麽用?PHP CSearch::loadIndex使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CSearch的用法示例。


在下文中一共展示了CSearch::loadIndex方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: CSearchLog

// Recherche par aggreg pour les logs
if ($date || $user_id) {
    $client_index = new CSearchLog();
    $client_index->createClient();
    $client_index->loadIndex($client_index->loadNameIndex());
    $date = CMbDT::format($date, "%Y/%m/%d");
    $words .= "date:[" . $date . " TO " . "{$date}] user_id:(" . $user_id . ")";
    $agregation = array();
    $tabActive = "";
    if (!$types) {
        $types = $client_index->loadContextes();
    }
} else {
    $client_index = new CSearch();
    $client_index->createClient();
    $client_index->loadIndex();
    $words .= " object_ref_class:" . $object_ref_class . " " . "object_ref_id:" . $object_ref_id;
    $results = $client_index->queryByType($words, null, $types);
    $agregation = $results->getAggregation("ref_type");
    $tabActive = $agregation["buckets"][0]["key"];
}
try {
    $results = $client_index->queryByType($words, $client_index->_index->getName(), $types);
    $agregation = $results->getAggregation("ref_type");
    $tabActive = $agregation["buckets"][0]["key"];
} catch (Exception $e) {
    CAppUI::displayAjaxMsg("Problème à la récupération des données", UI_MSG_ERROR);
}
$smarty = new CSmartyDP();
$smarty->assign("agregation", $agregation["buckets"]);
$smarty->assign("date", $date);
開發者ID:fbone,項目名稱:mediboard4,代碼行數:31,代碼來源:ajax_result_search_details_aggreg.php

示例2: loadCartoInfos

 /**
  * Method to load cartos infos
  *
  * @param CSearch $c_search the csearch
  * @param array   $aggreg   the aggreg
  *
  * @return array
  */
 function loadCartoInfos($c_search, $aggreg)
 {
     $result = array();
     $search = new CSearchIndexing();
     // récupération de l'index, cluster
     $index = $c_search->loadIndex();
     $cluster = $c_search->_client->getCluster();
     // statistiques du cluster
     $path = '_cluster/stats';
     $response = $c_search->_client->request($path, Request::GET);
     $data = $response->getData();
     $result['stats']['cluster']["nbIndex"] = $data["indices"]["count"];
     $result['stats']['cluster']["nbDocsTotal"] = $data["indices"]["docs"]["count"];
     // récupération du mapping et du name_index
     $result['mapping'] = $index->getMapping();
     $result['mappingjson'] = json_encode($result['mapping']);
     $result['name_index'] = $index->getName();
     // récupération de la taille totale des indexes et de statistiques
     $stats = $index->getStats()->getData();
     $result['size'] = CMbString::toDecaBinary($stats["_all"]["primaries"]["store"]["size_in_bytes"]);
     // récupération de l'état des shards
     $result['stats']['shards']["total"] = $stats["_shards"]['total'];
     $result['stats']['shards']["successful"] = $stats["_shards"]['successful'];
     $result['stats']['shards']["failed"] = $stats["_shards"]['failed'];
     // récupération de statistiques
     $name = CAppUI::conf("search index_name");
     $result['stats']["search"]['total'] = $stats["indices"][$name]["primaries"]["search"]["query_total"];
     $result['stats']["search"]['average_time'] = $stats["indices"][$name]["primaries"]["search"]["query_time_in_millis"];
     // récupération du nombre de docs "indexés",  "à indexer" et récupération des types d'éléments restant à indexer.
     $result['nbDocs_indexed'] = $index->count();
     $result['nbdocs_to_index'] = $search->countList();
     $order = "`object_class`, COUNT(`object_class`) AS `total`";
     $result['nbdocs_to_index_by_type'] = $search->countMultipleList(null, null, "object_class", null, $order);
     // récupération du statut de la connexion et du cluster
     $result['status'] = $cluster->getHealth()->getStatus();
     $result['connexion'] = $c_search->_client->hasConnection();
     // récupération des données de l'agregation
     $aggreg = $aggreg->getAggregation("ref_type");
     $result["aggregation"] = $aggreg["buckets"];
     return $result;
 }
開發者ID:fbone,項目名稱:mediboard4,代碼行數:49,代碼來源:CSearchQuery.class.php


注:本文中的CSearch::loadIndex方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。