本文整理汇总了PHP中vB_Search_Core::get_instance方法的典型用法代码示例。如果您正苦于以下问题:PHP vB_Search_Core::get_instance方法的具体用法?PHP vB_Search_Core::get_instance怎么用?PHP vB_Search_Core::get_instance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vB_Search_Core
的用法示例。
在下文中一共展示了vB_Search_Core::get_instance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
}
示例2: 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));
}
}
示例3: 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);
}
示例4: 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);
}
}
示例5: 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);
}
示例6: 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);
}
示例7: 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();
}
示例8: 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;
}
示例9: 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;
}
示例10: 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()));
}
示例11: __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');
}
示例12: 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)
{
示例13: get_contenttype
public function get_contenttype()
{
return vB_Search_Core::get_instance()->get_contenttypeid('vBBlog', 'BlogEntry');
}
示例14: get_contenttype
public function get_contenttype()
{
return vB_Search_Core::get_instance()->get_contenttypeid('vBForum', 'Thread');
}
示例15: 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'));
}
}