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


PHP Indexer::reindex方法代码示例

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


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

示例1: reindex

 function reindex()
 {
     try {
         echo Indexer::reindex($_POST['page']);
     } catch (\Exception $ex) {
         header("HTTP/1.0 500 Internal Server Error");
         echo $ex->getMessage();
     }
     die;
 }
开发者ID:pivotlearning,项目名称:wpsite,代码行数:10,代码来源:hooks.php

示例2: add_action

<?php

namespace elasticsearch;

add_action('wp_ajax_esreindex', function () {
    try {
        echo Indexer::reindex($_POST['page']);
    } catch (\Exception $ex) {
        header("HTTP/1.0 500 Internal Server Error");
        echo $ex->getMessage();
    }
    die;
});
add_action('admin_head-toplevel_page_elastic_search', function () {
    wp_enqueue_script('es-indexing', plugins_url('/manage-index.js', __FILE__), array('jquery'));
    wp_localize_script('es-indexing', 'indexing', array('ajaxurl' => admin_url('admin-ajax.php'), 'total' => Indexer::get_count(), 'perpage' => Indexer::per_page()));
});
add_filter('nhp-opts-saved-text-elasticsearch', function ($default) {
    if (get_transient('es-wiped') == 1) {
        return '<strong>The index has been wiped.</strong>';
        delete_transient('es-wiped');
    }
    if (get_transient('es-indexed') == 1) {
        return '<strong>The index has been populated.</strong>';
        delete_transient('es-indexed');
    }
    return $default;
});
add_action('nhp-opts-options-validate-elasticsearch', function () {
    if (isset($_POST['wipe']) && $_POST['wipe']) {
        try {
开发者ID:viz,项目名称:wordpress-fantastic-elasticsearch,代码行数:31,代码来源:manage-index.php

示例3: testMapDate

 public function testMapDate()
 {
     update_option('fields', array('post_date' => 1));
     register_post_type('post');
     wp_insert_post(array('post_type' => 'post', 'post_date' => '07/30/1989 00:00:00 CST'));
     wp_insert_post(array('post_type' => 'post', 'post_date' => '10/30/1988 00:00:00 CST'));
     Indexer::_map();
     Indexer::reindex();
     $this->index->refresh();
     $search = new \Elastica\Search($this->index->getClient());
     $search->addIndex($this->index);
     $results = $search->search(new \Elastica\Query(array('sort' => array('post_date' => array('order' => 'asc')))))->getResults();
     $this->assertCount(2, $results);
     $this->assertEquals(2, $results[0]->getId());
     $this->assertEquals(1, $results[1]->getId());
     $results = $search->search(new \Elastica\Query(array('sort' => array('post_date' => array('order' => 'desc')))))->getResults();
     $this->assertCount(2, $results);
     $this->assertEquals(1, $results[0]->getId());
     $this->assertEquals(2, $results[1]->getId());
 }
开发者ID:viz,项目名称:wordpress-fantastic-elasticsearch,代码行数:20,代码来源:IndexerIntegrationTest.php


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