当前位置: 首页>>代码示例>>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;未经允许,请勿转载。