当前位置: 首页>>代码示例>>PHP>>正文


PHP SearchResult::nextHit方法代码示例

本文整理汇总了PHP中SearchResult::nextHit方法的典型用法代码示例。如果您正苦于以下问题:PHP SearchResult::nextHit方法的具体用法?PHP SearchResult::nextHit怎么用?PHP SearchResult::nextHit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SearchResult的用法示例。


在下文中一共展示了SearchResult::nextHit方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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

示例3: 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

示例4: nextHit

 /**
  * Fetched next hit in result set.
  * Overrides SearchResult::nextHit() to implement result filtering
  *
  * @return bool True if next hit was loaded, false if there are no more hits to iterate through
  */
 public function nextHit()
 {
     if ($this->ops_filter_field) {
         while ($vb_r = parent::nextHit()) {
             if (in_array($this->get($this->ops_filter_field), $this->opa_filter_values)) {
                 return $vb_r;
             }
         }
     }
     return parent::nextHit();
 }
开发者ID:guaykuru,项目名称:pawtucket,代码行数:17,代码来源:BaseSearchResult.php

示例5: _collectCheckoutData

 /**
  * Roll up by-user data for return
  *
  * @param SearchResult $qr_res A ca_object_checkouts result set
  * @param string $ps_display_template Optional display template; will be returned in _display key in returned array
  *
  * @return array List of events (checkins, checkouts, etc.)
  */
 private static function _collectCheckoutData($qr_res, $ps_display_template = null)
 {
     $va_checkouts = array();
     if ($qr_res) {
         while ($qr_res->nextHit()) {
             $va_tmp = array('checkout_id' => $qr_res->get('ca_object_checkouts.checkout_id'), 'group_uuid' => $qr_res->get('ca_object_checkouts.group_uuid'), 'object_id' => $qr_res->get('ca_object_checkouts.object_id'), 'created_on' => $qr_res->get('ca_object_checkouts.created_on', array('timeOmit' => true)), 'checkout_date' => $qr_res->get('ca_object_checkouts.checkout_date', array('timeOmit' => true)), 'due_date' => $qr_res->get('ca_object_checkouts.due_date', array('timeOmit' => true)), 'return_date' => $qr_res->get('ca_object_checkouts.return_date', array('timeOmit' => true)), 'checkout_notes' => $qr_res->get('ca_object_checkouts.checkout_notes'));
             if ($ps_display_template) {
                 $va_tmp['_display'] = $qr_res->getWithTemplate($ps_display_template);
             }
             $va_checkouts[] = $va_tmp;
         }
     }
     return $va_checkouts;
 }
开发者ID:idiscussforum,项目名称:providence,代码行数:22,代码来源:ca_object_checkouts.php


注:本文中的SearchResult::nextHit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。