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


PHP SearchResult::seek方法代碼示例

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


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

示例1: canHandle

 /**
  * Determines if there is any data in the data set that can be visualized by this plugin using the provided settings
  *
  * @param SearchResult $po_data
  * @param array $pa_viz_settings Visualization settings
  *
  * @return bool True if data can be visualized
  */
 public function canHandle($po_data, $pa_viz_settings)
 {
     $vn_cur_pos = $po_data->currentIndex();
     if ($vn_cur_pos < 0) {
         $vn_cur_pos = 0;
     }
     $po_data->seek(0);
     $o_dm = Datamodel::load();
     //
     // Make sure sources actually exist
     //
     $va_sources = $pa_viz_settings['sources'];
     foreach ($va_sources as $vs_source_code => $va_source_info) {
         $va_tmp = explode('.', $va_source_info['data']);
         $t_instance = $o_dm->getInstanceByTableName($va_tmp[0], true);
         if (!($t_instance = $o_dm->getInstanceByTableName($va_tmp[0], true))) {
             unset($va_sources[$vs_source_code]);
             continue;
         }
         if (!$t_instance->hasField($va_tmp[1]) && !$t_instance->hasElement($va_tmp[1])) {
             unset($va_sources[$vs_source_code]);
         }
     }
     $vn_c = 0;
     //
     // Only check the first 10,000 returned rows before giving up, to avoid timeouts
     //
     while ($po_data->nextHit() && $vn_c < 10000) {
         foreach ($va_sources as $vs_source_code => $va_source_info) {
             if (trim($po_data->get($va_source_info['data']))) {
                 $po_data->seek($vn_cur_pos);
                 return true;
             }
         }
         $vn_c++;
     }
     $po_data->seek($vn_cur_pos);
     return false;
 }
開發者ID:guaykuru,項目名稱:pawtucket,代碼行數:47,代碼來源:TimelineJS.php

示例2: seek

 public function seek($pn_index)
 {
     if ($this->ops_filter_field) {
         parent::seek(0);
         for ($vn_i = 0; $vn_i < $pn_index; $vn_i++) {
             $this->nextHit();
         }
         return true;
     } else {
         return parent::seek($pn_index);
     }
 }
開發者ID:guaykuru,項目名稱:pawtucket,代碼行數:12,代碼來源:BaseSearchResult.php

示例3: exportRecordsFromSearchResultToArray

 /**
  * Export set of records from a given SearchResult object to an array of strings with the individual exports, keyed by primary key.
  * The behavior is tailored towards the needs of the OAIPMHService.
  *
  * @param string $ps_exporter_code defines the exporter to use
  * @param SearchResult $po_result search result as object
  * @param  array $pa_options
  * 		'start' =
  *   	'limit' =
  * @return array exported data
  */
 public static function exportRecordsFromSearchResultToArray($ps_exporter_code, $po_result, $pa_options = null)
 {
     $vn_start = isset($pa_options['start']) ? (int) $pa_options['start'] : 0;
     $vn_limit = isset($pa_options['limit']) ? (int) $pa_options['limit'] : 0;
     ca_data_exporters::$s_exporter_cache = array();
     ca_data_exporters::$s_exporter_item_cache = array();
     require_once __CA_LIB_DIR__ . '/core/Search/SearchResult.php';
     if (!$po_result instanceof SearchResult) {
         return false;
     }
     if (!($t_mapping = ca_data_exporters::loadExporterByCode($ps_exporter_code))) {
         return false;
     }
     if (sizeof(ca_data_exporters::checkMapping($ps_exporter_code)) > 0) {
         return false;
     }
     $t_instance = $t_mapping->getAppDatamodel()->getInstanceByTableNum($t_mapping->get('table_num'));
     if ($vn_start > 0 && $vn_start < $po_result->numHits()) {
         $po_result->seek($vn_start);
     }
     $va_return = array();
     $vn_i = 0;
     while ($po_result->nextHit()) {
         if ($vn_limit && $vn_i >= $vn_limit) {
             break;
         }
         $vn_pk_val = $po_result->get($t_instance->primaryKey());
         $va_return[$vn_pk_val] = ca_data_exporters::exportRecord($ps_exporter_code, $vn_pk_val);
         $vn_i++;
     }
     return $va_return;
 }
開發者ID:samrahman,項目名稱:providence,代碼行數:43,代碼來源:ca_data_exporters.php

示例4: canHandle

 /**
  * Determines if there is any data in the data set that can be visualized by this plugin using the provided settings
  *
  * @param SearchResult $po_data
  * @param array $pa_viz_settings Visualization settings
  *
  * @return bool True if data can be visualized
  */
 public function canHandle($po_data, $pa_viz_settings)
 {
     $vn_cur_pos = $po_data->currentIndex();
     if ($vn_cur_pos < 0) {
         $vn_cur_pos = 0;
     }
     $po_data->seek(0);
     $va_sources = $pa_viz_settings['sources'];
     while ($po_data->nextHit()) {
         foreach ($va_sources as $vs_source_code => $va_source_info) {
             if (trim($po_data->get($va_source_info['data']))) {
                 $po_data->seek($vn_cur_pos);
                 return true;
             }
         }
     }
     $po_data->seek($vn_cur_pos);
     return false;
 }
開發者ID:ffarago,項目名稱:pawtucket2,代碼行數:27,代碼來源:Timeline.php


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