• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP vB_Search_Core类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中vB_Search_Core的典型用法代码示例。如果您正苦于以下问题:PHP vB_Search_Core类的具体用法?PHP vB_Search_Core怎么用?PHP vB_Search_Core使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了vB_Search_Core类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: index_thread

	/**
	 * Index a thread
	 *
	 * By default this will look up all of the posts in a thread and calls the core
	 * indexer for each one
	 *
	 * @param int $id the thread id
	 */
	public function index_thread($id)
	{
		global $vbulletin;

		$thread = vB_Legacy_Thread::create_from_id($id);
		
		// make sure thread comes from the CMS comment forum 
		if ($thread->get_field('forumid') != $vbulletin->options['vbcmsforumid'])
		{
			return;
		}

		$set = $vbulletin->db->query_read("
			SELECT post.* FROM " . TABLE_PREFIX . "post AS post WHERE threadid = " . intval($id)
		);

		$indexer = vB_Search_Core::get_instance()->get_core_indexer();
		while ($row = $vbulletin->db->fetch_array($set))
		{
			$post = vB_Legacy_Post::create_from_record($row, $thread);
			$fields = $this->post_to_indexfields($post);
			if ($fields)
			{
				$indexer->index($fields);
			}
		}
	}
开发者ID:hungnv0789,项目名称:vhtm,代码行数:35,代码来源:cmscomment.php


示例2: indexQueue

 /**
 * vb_Search_Indexcontroller_Queue::indexQueue()
 *
 * Index an item based on a map of fieldname/value pairs
 *
 * @param string $package : the package which we are indexing
 * @param string $contenttype : text string with the type of content
 * @param string $operation: the index action, which will vary depending on the action.
 *    usually it will just be "index"
 * @param data : If we have fourth parameter we take it as an associative array of field values
 * @return : boolean success indicator
 */
 public static function indexQueue($package, $contenttype, $operation)
 {
     $data = array_slice(func_get_args(), 3);
     global $vbulletin;
     $db = vB_Search_Core::get_db();
     //For now we need to compose an sql query. Parameters are not available.
     //First make sure we've got good data. If we don't have the three parameters
     if (isset($package)) {
         $dbfields['package'] = "'" . $db->escape_string($package) . "'";
     } else {
         return false;
     }
     if (isset($contenttype)) {
         $dbfields['contenttype'] = "'" . $db->escape_string($contenttype) . "'";
     } else {
         return false;
     }
     if (isset($operation)) {
         $dbfields['operation'] = "'" . $db->escape_string($operation) . "'";
     }
     if (!$vbulletin->options['searchqueueupdates']) {
         // we just call indexNow. It checks for valid data.
         return vB_Search_Indexcontroller_QueueProcessor::indexNow($package, $contenttype, $operation, $data);
     }
     $dbfields['data'] = "'" . $db->escape_string(serialize($data)) . "'";
     $sql = "INSERT INTO " . TABLE_PREFIX . "indexqueue (" . implode(', ', array_keys($dbfields)) . ")\n\t\t\tVALUES ( " . implode(', ', $dbfields) . " )";
     $db->query_write($sql);
     return true;
 }
开发者ID:0hyeah,项目名称:yurivn,代码行数:41,代码来源:queue.php


示例3: index

 /**
  * vBForum_Search_IndexController_VisitorMessage::index()
  *
  * @param integer $id : the record id to be indexed
  */
 public function index($id)
 {
     global $vbulletin;
     //we just pull a record from the database.
     if ($rst = $vbulletin->db->query_read("SELECT visitormessage.* FROM " . TABLE_PREFIX . "visitormessage AS visitormessage WHERE vmid = {$id}") and $row = $vbulletin->db->fetch_array($rst)) {
         vB_Search_Core::get_instance()->get_core_indexer()->index($this->recordToIndexfields($row));
     }
 }
开发者ID:0hyeah,项目名称:yurivn,代码行数:13,代码来源:visitormessage.php


示例4: delete

 /**
  * Delete "group message" (blog entry).
  * 
  * Due to stupid schema design, indexed data placed in `blog_text`
  * table. But we receive ID from `blog` table. Should remap it,
  * prior to place to queue 
  *
  * @param int $id
  */
 public function delete($id)
 {
     $blog_text_id = $this->_get_blog_text_id($id);
     if (!$blog_text_id) {
         return false;
     }
     $indexer = vB_Search_Core::get_instance()->get_core_indexer();
     return $indexer->delete($this->get_contenttypeid(), $blog_text_id);
 }
开发者ID:rcdesign,项目名称:vb-sphinx_search,代码行数:18,代码来源:blogentry.php


示例5: init

 /**
  * Enter description here...
  *
  */
 static function init()
 {
     //register implementation objects with the search system.
     $search = vB_Search_Core::get_instance();
     $search->register_core_indexer(new vBDBSearch_Indexer());
     $search->register_index_controller('vBForum', 'Post', new vBDBSearch_PostIndexController());
     $__vBDBSearch_CoreSearchController = new vBDBSearch_CoreSearchController();
     $search->register_default_controller($__vBDBSearch_CoreSearchController);
     //		$search->register_search_controller('vBForum', 'Post',$__vBDBSearch_CoreSearchController);
 }
开发者ID:0hyeah,项目名称:yurivn,代码行数:14,代码来源:core.php


示例6: index_id_range

 public function index_id_range($start, $finish)
 {
     global $vbulletin;
     $indexer = vB_Search_Core::get_instance()->get_core_indexer();
     $set = $vbulletin->db->query_read_slave($q = $this->make_query("forum.forumid BETWEEN " . intval($start) . " AND " . intval($finish)));
     while ($row = $vbulletin->db->fetch_array($set)) {
         $fields = $this->record_to_indexfields($row);
         $indexer->index($fields);
     }
 }
开发者ID:0hyeah,项目名称:yurivn,代码行数:10,代码来源:forum.php


示例7: index_id_range

 /**
  * Index group message range
  *
  * @param int $start
  * @param int $end
  */
 public function index_id_range($start, $end)
 {
     global $vbulletin;
     $set = $vbulletin->db->query($this->get_query("m.gmid >= " . intval($start) . " AND m.gmid <= " . intval($end)));
     $indexer = vB_Search_Core::get_instance()->get_core_indexer();
     while ($row = $vbulletin->db->fetch_array($set)) {
         $indexer->index($this->record_to_indexfields($row));
     }
     $vbulletin->db->free_result($set);
 }
开发者ID:0hyeah,项目名称:yurivn,代码行数:16,代码来源:socialgroupmessage.php


示例8: init

 /**
  * Mandatory to overwrite for init specific search components
  *
  */
 static function init()
 {
     //register implementation objects with the search system.
     $search = vB_Search_Core::get_instance();
     $search->register_core_indexer(new vBSphinxSearch_Indexer());
     $search->register_index_controller('vBForum', 'Post', new vBSphinxSearch_Search_IndexController_Post());
     $search->register_index_controller('vBBlog', 'BlogComment', new vBSphinxSearch_Search_IndexController_BlogComment());
     $search->register_index_controller('vBBlog', 'BlogEntry', new vBSphinxSearch_Search_IndexController_BlogEntry());
     $search->register_index_controller('vBForum', 'SocialGroupMessage', new vBSphinxSearch_Search_IndexController_SocialGroupMessage());
     $__vBSphinxSearch_CoreSearchController = new vBSphinxSearch_CoreSearchController();
     $search->register_default_controller($__vBSphinxSearch_CoreSearchController);
     self::_init_index_map();
 }
开发者ID:rcdesign,项目名称:vb-sphinx_search,代码行数:17,代码来源:core.php


示例9: get_instance

 /**
  * Returns the singleton instance for the search core
  *
  * @return vB_Search_Core
  */
 public static function get_instance()
 {
     if (is_null(self::$instance)) {
         self::$instance = new vB_Search_Core();
         //initialize the search implementation
         global $vbulletin;
         if (!empty($vbulletin->options['searchimplementation'])) {
             call_user_func(array($vbulletin->options['searchimplementation'], 'init'));
         }
         //	self::$instance->register_search_controller('vb', 'Tag', new vb_Search_SearchController_Tag());
     }
     return self::$instance;
 }
开发者ID:0hyeah,项目名称:yurivn,代码行数:18,代码来源:core.php


示例10: get_results

 public function get_results($user, $criteria)
 {
     global $vbulletin;
     $db = $vbulletin->db;
     $range_filters = $criteria->get_range_filters();
     //get thread/post results.
     $lastpost_where = array();
     $post_lastpost_where = array();
     if (!empty($range_filters['markinglimit'][0])) {
         $cutoff = $range_filters['markinglimit'][0];
         $marking_join = "\n\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "discussionread AS discussionread ON\n\t\t\t\t\t(discussionread.discussionid = discussion.discussionid AND discussionread.userid = " . $vbulletin->userinfo['userid'] . ")\n\t\t\t";
         $lastpost_where[] = "discussion.lastpost > IF(discussionread.readtime IS NULL,\n\t\t\t\t{$cutoff}, discussionread.readtime)";
         $lastpost_where[] = "discussion.lastpost > {$cutoff}";
         $post_lastpost_where[] = "groupmessage.dateline > IF(discussionread.readtime IS NULL,\n\t\t\t\t{$cutoff}, discussionread.readtime)";
         $post_lastpost_where[] = "groupmessage.dateline > {$cutoff}";
     } else {
         //get date cut -- but only if we're not using the threadmarking filter
         if (isset($range_filters['datecut'])) {
             //ignore any upper limit
             $datecut = $range_filters['datecut'][0];
         } else {
             return $results;
         }
         $marking_join = '';
         $lastpost_where[] = "discussion.lastpost >= {$datecut}";
         $post_lastpost_where[] = "groupmessage.dateline >= {$datecut}";
     }
     $this->process_orderby($criteria);
     if ($criteria->get_grouped() == vB_Search_Core::GROUP_NO) {
         $where = array_merge($lastpost_where, $post_lastpost_where);
         $contenttypeid = vB_Search_Core::get_instance()->get_contenttypeid('vBForum', 'SocialGroupMessage');
         $set = $db->query_read_slave("\n\t\t\t\tSELECT groupmessage.gmid, discussion.discussionid\n\t\t\t\tFROM " . TABLE_PREFIX . "groupmessage AS groupmessage\n\t\t\t\tINNER JOIN " . TABLE_PREFIX . "discussion AS discussion ON\n\t\t\t\t\t(discussion.discussionid = groupmessage.discussionid)\n\t\t\t\t{$marking_join}\n\t\t\t\t" . implode("\n", $this->orderby_join) . "\n\t\t\t\tWHERE " . implode(' AND ', $where) . "\n\t\t\t\tORDER BY {$this->orderby}\n\t\t\t\tLIMIT " . intval($vbulletin->options['maxresults']));
         while ($row = $db->fetch_array($set)) {
             $results[] = array($contenttypeid, $row['gmid'], $row['discussionid']);
         }
     } else {
         $contenttypeid = vB_Search_Core::get_instance()->get_contenttypeid('vBForum', 'SocialGroupDiscussion');
         $set = $db->query_read_slave("\n\t\t\t\tSELECT discussion.discussionid\n\t\t\t\tFROM " . TABLE_PREFIX . "discussion AS discussion\n\t\t\t\t{$marking_join}\n\t\t\t\t" . implode("\n", $this->orderby_join) . "\n\t\t\t\tWHERE " . implode(' AND ', $lastpost_where) . "\n\t\t\t\tORDER BY {$this->orderby}\n\t\t\t\tLIMIT " . intval($vbulletin->options['maxresults']));
         while ($row = $db->fetch_array($set)) {
             $results[] = array($contenttypeid, $row['discussionid'], $row['discussionid']);
         }
     }
     return $results;
 }
开发者ID:0hyeah,项目名称:yurivn,代码行数:44,代码来源:newsocialgroupmessage.php


示例11: get_results

	public function get_results($user, $criteria)
	{
		global $vbulletin;
		$db = $vbulletin->db;

		$range_filters = $criteria->get_range_filters();
		//$equals_filters = $criteria->get_equals_filters();
		//$notequals_filter = $criteria->get_equals_filters();

		$results = array();
		//get date cut -- no marking, just use the datecut.
		if (isset($range_filters['datecut']))
		{
			//ignore any upper limit
			$datecut = $range_filters['datecut'][0];
		}
		else
		{
			return $results;
		}

		$this->process_orderby($criteria);

		$contenttypeid = vB_Search_Core::get_instance()->get_contenttypeid('vBForum', 'Event');
		$set = $db->query_read_slave($q = "
			SELECT event.eventid
			FROM " . TABLE_PREFIX . "event AS event " . implode(" ", $this->joins) . "
			WHERE
				event.dateline >= $datecut
			ORDER BY {$this->orderby}
			LIMIT " . intval($vbulletin->options['maxresults'])
		);

		while ($row = $db->fetch_array($set))
		{
			$results[] = array($contenttypeid, $row['eventid'], $row['eventid']);
		}
		return $results;
	}
开发者ID:hungnv0789,项目名称:vhtm,代码行数:39,代码来源:newevent.php


示例12: output

 public function output()
 {
     global $vbulletin, $db;
     $vbulletin->input->clean_array_gpc('r', array('userids' => TYPE_STR, 'contenttypeids' => TYPE_STR));
     $vbulletin->GPC['userids'] = convert_urlencoded_unicode($vbulletin->GPC['userids']);
     $userids = $vbulletin->GPC['userids'];
     $vbulletin->GPC['contenttypeids'] = convert_urlencoded_unicode($vbulletin->GPC['contenttypeids']);
     $contenttypeids = $vbulletin->GPC['contenttypeids'];
     require_once DIR . "/vb/search/core.php";
     require_once DIR . "/vb/legacy/currentuser.php";
     require_once DIR . "/vb/search/resultsview.php";
     require_once DIR . "/vb/search/searchtools.php";
     $search_core = vB_Search_Core::get_instance();
     $current_user = new vB_Legacy_CurrentUser();
     if (!$vbulletin->options['enablesearches']) {
         return $this->error('searchdisabled');
     }
     $criteria = $search_core->create_criteria(vB_Search_Core::SEARCH_ADVANCED);
     $userids_a = explode(',', $userids);
     $contenttypeids_a = explode(',', $contenttypeids);
     if (empty($userids_a)) {
         return $this->error('invalidid');
     }
     $criteria->add_userid_filter($userids_a, vB_Search_Core::GROUP_NO);
     if (!empty($contenttypeids_a)) {
         $criteria->add_contenttype_filter($contenttypeids_a);
     }
     $results = null;
     if (!($vbulletin->debug or $vbulletin->GPC_exists['nocache'] and $vbulletin->GPC['nocache'])) {
         $results = vB_Search_Results::create_from_cache($current_user, $criteria);
     }
     if (!$results) {
         $results = vB_Search_Results::create_from_criteria($current_user, $criteria);
     }
     return array("response" => array("errormessage" => "search"), "show" => array("searchid" => $results->get_searchid()));
 }
开发者ID:0hyeah,项目名称:yurivn,代码行数:36,代码来源:search_findusers.php


示例13: delete_id_range

 /**
  * Delete a range of items
  *
  * @param int $start
  * @param int $end
  */
 public function delete_id_range($start, $end)
 {
     $indexer = vB_Search_Core::get_instance()->get_core_indexer();
     for ($i = $start; $i <= $end; $i++) {
         $indexer->delete($id);
     }
 }
开发者ID:0hyeah,项目名称:yurivn,代码行数:13,代码来源:indexcontroller.php


示例14: get_groups

 private function get_groups($types)
 {
     //no types filters
     if (!$types) {
         return array();
     }
     //sort types into group by default/item by default buckets
     $search = vB_Search_Core::get_instance();
     $group_types = array();
     $item_types = array();
     foreach ($types as $typeid) {
         $type = $search->get_search_type_from_id($typeid);
         if ($type->can_group()) {
             $group_types[] = $type->get_groupcontenttypeid();
         } else {
             $group_types[] = $typeid;
         }
     }
     return $group_types;
 }
开发者ID:0hyeah,项目名称:yurivn,代码行数:20,代码来源:coresearchcontroller.php


示例15: merge_group

 /**
  * We just pass this to the core indexer, which knows how to do this.
  */
 public function merge_group($oldid, $newid)
 {
     $indexer = vB_Search_Core::get_instance()->get_core_indexer();
     $indexer->merge_group($this->groupcontenttypeid, $oldid, $newid);
 }
开发者ID:0hyeah,项目名称:yurivn,代码行数:8,代码来源:postindexcontroller.php


示例16: get_contenttype

	public function get_contenttype()
	{
		return vB_Search_Core::get_instance()->get_contenttypeid('vBBlog', 'BlogEntry');
	}
开发者ID:hungnv0789,项目名称:vhtm,代码行数:4,代码来源:blogentry.php


示例17: __construct

 public function __construct()
 {
 	$this->groupcontenttypeid = vB_Search_Core::get_instance()->get_contenttypeid('vBBlog', 'BlogEntry');
 	$this->contenttypeid = vB_Search_Core::get_instance()->get_contenttypeid('vBBlog', 'BlogComment');
 }
开发者ID:hungnv0789,项目名称:vhtm,代码行数:5,代码来源:blogcomment.php


示例18: deleteSearchContent

	/**
	 * Removes content from the indes.
	 */
	protected function deleteSearchContent()
	{
		if (!$type_info = vB_Search_Core::get_instance()->get_indexed_types($this->item->getContentTypeId()))
		{
			//$this->item->getId() (returns the contentid) reflects the value prior to saving anything.
			//this means that on first save it will be 0 because the content record hasn't been set yet.
			vB_Search_Indexcontroller_Queue::indexQueue($this->item->getPackage(), $this->item->getClass(), 'delete', $this->getField('contentid'));
		}
	}
开发者ID:hungnv0789,项目名称:vhtm,代码行数:12,代码来源:content.php


示例19: array

	print_table_header($vbphrase['add_missing_thread_keywords']);
	print_input_row($vbphrase['number_of_threads_to_process_per_cycle'], 'perpage', 1000);
	print_submit_row($vbphrase['add_keywords']);

	print_form_header('misc', 'lostusers');
	print_table_header($vbphrase['fix_broken_user_profiles']);
	print_description_row($vbphrase['finds_users_without_complete_entries']);
	print_submit_row($vbphrase['fix_broken_user_profiles']);

	print_form_header('misc', 'doindextypes');
	print_table_header($vbphrase['rebuild_search_index'], 2, 0);
	print_description_row(construct_phrase($vbphrase['note_reindexing_empty_indexes_x'], $vbulletin->session->vars['sessionurl']));

	// Get the current types
	require_once(DIR . '/vb/search/core.php');
	$indexer = vB_Search_Core::get_instance();

	//don't use array_merge, it will (incorrectly) assume that the keys are index values
	//instead of meaningful numeric keys and renumber them.
	$types = array ( 0 => $vbphrase['all']) + vB_Search_Searchtools::get_type_options();

	print_select_row($vbphrase['search_content_type_to_index'], 'indextypes', $types);
	print_input_row($vbphrase['search_items_batch'], 'perpage', 250);
	print_input_row($vbphrase['search_start_item_id'], 'startat', 0);
	print_input_row($vbphrase['search_items_to_process'], 'doprocess', 0);
	print_yes_no_row($vbphrase['include_automatic_javascript_redirect'], 'autoredirect', 1);
	print_description_row($vbphrase['note_server_intensive']);
	print_submit_row($vbphrase['rebuild_search_index']);

	if ($vbulletin->options['cachemaxage'] > 0)
	{
开发者ID:hungnv0789,项目名称:vhtm,代码行数:31,代码来源:misc.php


示例20: getResults

	/**
	 * This sets up the search parameters, gets the query results,
	 * and renders them
	 *
	 * @param array $config
	 * @return string
	 */
	private function getResults($config)
	{
		include_once DIR . '/includes/functions_misc.php';
		$search_core = vB_Search_Core::get_instance();

		//first see if we can get cached results
		$hashkey = $this->getHash();
		$cache_data = vB_Cache::instance()->read($hashkey, false, false);
		if ($cache_data)
		{

			//If there are no id's, we're done.
			if (empty($cache_data['ids']))
			{
				return false;
			}

			$controller = vB_Search_Core::get_instance()->get_search_type_from_id($config['contenttypeid']);

			if (method_exists($controller, 'create_array'))
			{
				$results = $controller->create_array($cache_data['ids']);
			}
			else if(method_exists($controller, 'create_item'))
			{
				$results = array();
				foreach ($cache_data['ids'] as $resultid)
				{
					$result = $controller->create_item($resultid);
					if ($result)
					{
						$results[] = $result;
					}
				}
			}
			else
			{
				return false;
			}
			return array('results' => $results, 'criteria' => $cache_data['criteria']);
		}

		$rst = vB::$vbulletin->db->query_read("SELECT relationid FROM "
		. TABLE_PREFIX . "userlist WHERE friend='yes' AND userid = "
		. vB::$vbulletin->userinfo['userid']
		);

		if (!$rst)
		{
			return false;
		}
		$userids = array();

		while($row = vB::$vbulletin->db->fetch_row($rst))
		{
			$userids[] = $row[0];
		}

		//If there are no friends there's no friend information.
		if (! count($userids))
		{
			return '';
		}

		if ($config['contenttypeid'] == null)
		{
			$config['contenttypeid']= array();
		}
		else if (!is_array($config['contenttypeid']))
		{
			$config['contenttypeid'] = array($config['contenttypeid']);
		}

		if (!count($userids))
		{
			new vB_Phrase('global', 'your_friends_list_is_empty');
		}

		$criteria = vB_Search_Core::get_instance()->create_criteria(vB_Search_Core::SEARCH_ADVANCED);
		$criteria->add_contenttype_filter($config['contenttypeid']);
		$criteria->set_advanced_typeid($contenttypeid);

		$criteria->add_userid_filter($userids, false);
		$criteria->set_grouped(vB_Search_Core::GROUP_NO);
		$timelimit = TIMENOW - (86400 * $config['days']);
		$criteria->add_date_filter(vB_Search_Core::OP_GT, $timelimit);
		$criteria->set_sort('dateline', 'desc');
		$current_user = new vB_Legacy_CurrentUser();
		$results = vB_Search_Results::create_from_cache($current_user, $criteria);

		if (!$results)
		{
			$results = vB_Search_Results::create_from_criteria($current_user, $criteria);
//.........这里部分代码省略.........
开发者ID:hungnv0789,项目名称:vhtm,代码行数:101,代码来源:myfriends.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP vB_Template类代码示例发布时间:2022-05-23
下一篇:
PHP vB_Library类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap