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


PHP idx_get_indexer函数代码示例

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


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

示例1: test_numeric_twice_meta

 public function test_numeric_twice_meta()
 {
     $indexer = idx_get_indexer();
     $indexer->addMetaKeys('testpage', 'onezero', array('1010'));
     $indexer->addMetaKeys('notfound', 'onezero', array('1010'));
     $query = '1010';
     $this->assertEquals(array('notfound', 'testpage'), $indexer->lookupKey('onezero', $query));
 }
开发者ID:richmahn,项目名称:Door43,代码行数:8,代码来源:indexer_indexing.test.php

示例2: setUp

 function setUp()
 {
     parent::setUp();
     $this->indexer = idx_get_indexer();
     $this->indexer->clear();
     saveWikiText($this->old_id, 'Old test content', 'Created old test page for indexer rename test');
     idx_addPage($this->old_id);
 }
开发者ID:richmahn,项目名称:Door43,代码行数:8,代码来源:indexer_rename.test.php

示例3: test_media_in_footnotes

    public function test_media_in_footnotes() {
        saveWikiText('test:media_footnotes', '(({{footnote.png?20x50}} [[foonote|{{:footlink.png}}]]))', 'Test initialization');
        idx_addPage('test:media_footnotes');

        $query = array('test:footnote.png', 'footlink.png');
        $this->assertEquals(array(
            'test:footnote.png' => array('test:media_footnotes'),
            'footlink.png' => array('test:media_footnotes')
        ), idx_get_indexer()->lookupKey('relation_media', $query));
    }
开发者ID:neutrinog,项目名称:Door43,代码行数:10,代码来源:mediaindex.test.php

示例4: test_minlength

 function test_minlength()
 {
     $indexer = idx_get_indexer();
     $indexer->addMetaKeys('histo1', 'testkey', array('foo', 'bar', 'foobar'));
     $indexer->addMetaKeys('histo2', 'testkey', array('bar', 'testing'));
     $indexer->addMetaKeys('histo3', 'testkey', array('foo', 'foobar'));
     $histogram4 = $indexer->histogram(1, 0, 4, 'testkey');
     $this->assertEquals(array('foobar' => 2, 'testing' => 1), $histogram4);
     $histogram2 = $indexer->histogram(1, 0, 2, 'testkey');
     $this->assertEquals(array('foobar' => 2, 'testing' => 1, 'foo' => 2, 'bar' => 2), $histogram2);
 }
开发者ID:richmahn,项目名称:Door43,代码行数:11,代码来源:indexer_histogram.test.php

示例5: test_pid

 function test_pid()
 {
     $indexer = idx_get_indexer();
     $syntaxPID = $indexer->getPID('wiki:syntax');
     $this->assertEquals('wiki:syntax', $indexer->getPageFromPID($syntaxPID), 'getPageFromPID(getPID(\'wiki:syntax\')) != \'wiki:syntax\'');
     $dokuwikiPID = $indexer->getPID('wiki:dokuwiki');
     $this->assertEquals('wiki:syntax', $indexer->getPageFromPID($syntaxPID), 'getPageFromPID(getPID(\'wiki:syntax\')) != \'wiki:syntax\' after getting the PID for wiki:dokuwiki');
     $this->assertEquals($syntaxPID, $indexer->getPID('wiki:syntax'), 'getPID(\'wiki:syntax\') didn\'t returned different PIDs when called twice');
     $this->assertNotEquals($syntaxPID, $dokuwikiPID, 'Same PID returned for different pages');
     $this->assertTrue(is_numeric($syntaxPID) && is_numeric($dokuwikiPID), 'PIDs are not numeric');
 }
开发者ID:richmahn,项目名称:Door43,代码行数:11,代码来源:indexer_pid.test.php

示例6: _update

function _update()
{
    global $conf;
    global $INDEXER;
    $INDEXER = idx_get_indexer();
    $data = array();
    _quietecho("Searching pages... ");
    search($data, $conf['datadir'], 'search_allpages', array('skipacl' => true));
    _quietecho(count($data) . " pages found.\n");
    foreach ($data as $val) {
        _index($val['id']);
    }
}
开发者ID:AlexanderS,项目名称:Part-DB,代码行数:13,代码来源:indexer.php

示例7: generate

 /**
  * Builds a Google Sitemap of all public pages known to the indexer
  *
  * The map is placed in the cache directory named sitemap.xml.gz - This
  * file needs to be writable!
  *
  * @author Michael Hamann
  * @author Andreas Gohr
  * @link   https://www.google.com/webmasters/sitemaps/docs/en/about.html
  * @link   http://www.sitemaps.org/
  */
 public function generate()
 {
     global $conf;
     if ($conf['sitemap'] < 1 || !is_numeric($conf['sitemap'])) {
         return false;
     }
     $sitemap = Sitemapper::getFilePath();
     if (@file_exists($sitemap)) {
         if (!is_writable($sitemap)) {
             return false;
         }
     } else {
         if (!is_writable(dirname($sitemap))) {
             return false;
         }
     }
     if (@filesize($sitemap) && @filemtime($sitemap) > time() - $conf['sitemap'] * 86400) {
         // 60*60*24=86400
         dbglog('Sitemapper::generate(): Sitemap up to date');
         // FIXME: only in debug mode
         return false;
     }
     dbglog("Sitemapper::generate(): using {$sitemap}");
     // FIXME: Only in debug mode
     $pages = idx_get_indexer()->getPages();
     dbglog('Sitemapper::generate(): creating sitemap using ' . count($pages) . ' pages');
     $items = array();
     // build the sitemap items
     foreach ($pages as $id) {
         //skip hidden, non existing and restricted files
         if (isHiddenPage($id)) {
             continue;
         }
         if (auth_aclcheck($id, '', '') < AUTH_READ) {
             continue;
         }
         $item = SitemapItem::createFromID($id);
         if ($item !== NULL) {
             $items[] = $item;
         }
     }
     $eventData = array('items' => &$items, 'sitemap' => &$sitemap);
     $event = new Doku_Event('SITEMAP_GENERATE', $eventData);
     if ($event->advise_before(true)) {
         //save the new sitemap
         $result = io_saveFile($sitemap, Sitemapper::getXML($items));
     }
     $event->advise_after();
     return $result;
 }
开发者ID:rezlemic,项目名称:dokuwiki-jQuery,代码行数:61,代码来源:Sitemapper.php

示例8: setUpBeforeClass

 /**
  * Setup the data directory
  *
  * This is ran before each test class
  */
 public static function setUpBeforeClass()
 {
     // just to be safe not to delete something undefined later
     if (!defined('TMP_DIR')) {
         die('no temporary directory');
     }
     if (!defined('DOKU_TMP_DATA')) {
         die('no temporary data directory');
     }
     // remove any leftovers from the last run
     if (is_dir(DOKU_TMP_DATA)) {
         // clear indexer data and cache
         idx_get_indexer()->clear();
         TestUtils::rdelete(DOKU_TMP_DATA);
     }
     // populate default dirs
     TestUtils::rcopy(TMP_DIR, dirname(__FILE__) . '/../data/');
 }
开发者ID:rsnitsch,项目名称:dokuwiki,代码行数:23,代码来源:DokuWikiTest.php

示例9: _tagIndexLookup

 /**
  * Tag index lookup
  *
  * @param array $tags the tags to filter
  * @return array the matching page ids
  */
 function _tagIndexLookup($tags)
 {
     $result = array();
     // array of page ids
     $clean_tags = array();
     foreach ($tags as $i => $tag) {
         if ($tag[0] == '+' || $tag[0] == '-') {
             $clean_tags[$i] = substr($tag, 1);
         } else {
             $clean_tags[$i] = $tag;
         }
     }
     $indexer = idx_get_indexer();
     $pages = $indexer->lookupKey('subject', $clean_tags, array($this, '_tagCompare'));
     // use all pages as basis if the first tag isn't an "or"-tag or if there are no tags given
     if (empty($tags) || $clean_tags[0] != $tags[0]) {
         $result = $indexer->getPages();
     }
     foreach ($tags as $i => $tag) {
         $t = $clean_tags[$i];
         if (!is_array($pages[$t])) {
             $pages[$t] = array();
         }
         if ($tag[0] == '+') {
             // AND: add only if in both arrays
             $result = array_intersect($result, $pages[$t]);
         } elseif ($tag[0] == '-') {
             // NOT: remove array from docs
             $result = array_diff($result, $pages[$t]);
         } else {
             // OR: add array to docs
             $result = array_unique(array_merge($result, $pages[$t]));
         }
     }
     return $result;
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:42,代码来源:helper.php

示例10: _ft_pageLookup

function _ft_pageLookup(&$data)
{
    // split out original parameters
    $id = $data['id'];
    if (preg_match('/(?:^| )@(\\w+)/', $id, $matches)) {
        $ns = cleanID($matches[1]) . ':';
        $id = str_replace($matches[0], '', $id);
    }
    $in_ns = $data['in_ns'];
    $in_title = $data['in_title'];
    $cleaned = cleanID($id);
    $Indexer = idx_get_indexer();
    $page_idx = $Indexer->getPages();
    $pages = array();
    if ($id !== '' && $cleaned !== '') {
        foreach ($page_idx as $p_id) {
            if (strpos($in_ns ? $p_id : noNSorNS($p_id), $cleaned) !== false) {
                if (!isset($pages[$p_id])) {
                    $pages[$p_id] = p_get_first_heading($p_id, METADATA_DONT_RENDER);
                }
            }
        }
        if ($in_title) {
            foreach ($Indexer->lookupKey('title', $id, '_ft_pageLookupTitleCompare') as $p_id) {
                if (!isset($pages[$p_id])) {
                    $pages[$p_id] = p_get_first_heading($p_id, METADATA_DONT_RENDER);
                }
            }
        }
    }
    if (isset($ns)) {
        foreach (array_keys($pages) as $p_id) {
            if (strpos($p_id, $ns) !== 0) {
                unset($pages[$p_id]);
            }
        }
    }
    // discard hidden pages
    // discard nonexistent pages
    // check ACL permissions
    foreach (array_keys($pages) as $idx) {
        if (!isVisiblePage($idx) || !page_exists($idx) || auth_quickaclcheck($idx) < AUTH_READ) {
            unset($pages[$idx]);
        }
    }
    uksort($pages, 'ft_pagesorter');
    return $pages;
}
开发者ID:ngharaibeh,项目名称:Methodikos,代码行数:48,代码来源:fulltext.php

示例11: listPages

 /**
  * List all pages - we use the indexer list here
  */
 function listPages()
 {
     $list = array();
     $pages = idx_get_indexer()->getPages();
     $pages = array_filter(array_filter($pages, 'isVisiblePage'), 'page_exists');
     foreach (array_keys($pages) as $idx) {
         $perm = auth_quickaclcheck($pages[$idx]);
         if ($perm < AUTH_READ) {
             continue;
         }
         $page = array();
         $page['id'] = trim($pages[$idx]);
         $page['perms'] = $perm;
         $page['size'] = @filesize(wikiFN($pages[$idx]));
         $page['lastModified'] = $this->api->toDate(@filemtime(wikiFN($pages[$idx])));
         $list[] = $page;
     }
     return $list;
 }
开发者ID:neosunchess,项目名称:dokuwiki,代码行数:22,代码来源:RemoteAPICore.php

示例12: idx_tokenizer

/**
 * Split a string into tokens
 *
 */
function idx_tokenizer($string, $wc = false)
{
    $Indexer = idx_get_indexer();
    return $Indexer->tokenizer($string, $wc);
}
开发者ID:neutrinog,项目名称:Door43,代码行数:9,代码来源:indexer.php

示例13: clearindex

 /**
  * Clear all index files
  */
 function clearindex() {
     $this->quietecho("Clearing index... ");
     idx_get_indexer()->clear();
     $this->quietecho("done.\n");
 }
开发者ID:neutrinog,项目名称:Door43,代码行数:8,代码来源:indexer.php

示例14: page_lookup

 /**
  * A heavily customised version of _ft_pageLookup in inc/fulltext.php
  * no sorting!
  */
 function page_lookup($query, $fullregex, $incl_ns, $excl_ns)
 {
     global $conf;
     $query = trim($query);
     $pages = idx_get_indexer()->getPages();
     if (!$fullregex) {
         // first deal with excluded namespaces, then included, order matters!
         $pages = $this->_filter_ns($pages, $excl_ns, true);
         $pages = $this->_filter_ns($pages, $incl_ns, false);
     }
     $cnt = count($pages);
     for ($i = 0; $i < $cnt; $i++) {
         $page = $pages[$i];
         if (!page_exists($page) || isHiddenPage($page)) {
             unset($pages[$i]);
             continue;
         }
         if (!$fullregex) {
             $page = noNS($page);
         }
         /*
          * This is the actual "search" expression.
          * Note: preg_grep cannot be used because we need to
          *  allow for beginning of string "^" regex on normal page search
          *  and the page-exists check above
          * The @ prevents problems with invalid queries!
          */
         $matched = @preg_match('/' . $query . '/iS', $page);
         if ($matched === false) {
             return false;
         } elseif ($matched == 0) {
             unset($pages[$i]);
         }
     }
     if (count($pages) > 0) {
         return $pages;
     } else {
         // we always return an array type
         return array();
     }
 }
开发者ID:unfoldingWord-dev,项目名称:pagequery,代码行数:45,代码来源:pagequery.php

示例15: moveMedia

 /**
  * Execute a media file move/rename
  *
  * @param string $src original ID
  * @param string $dst new ID
  * @return bool true if the move was successfully executed
  */
 public function moveMedia($src, $dst)
 {
     if (!$this->checkMedia($src, $dst)) {
         return false;
     }
     // get all pages using this media
     $affected_pages = idx_get_indexer()->lookupKey('relation_media', $src);
     $src_ns = getNS($src);
     $src_name = noNS($src);
     $dst_ns = getNS($dst);
     $dst_name = noNS($dst);
     // pass this info on to other plugins
     $eventdata = array('opts' => array('ns' => $src_ns, 'name' => $src_name, 'newns' => $dst_ns, 'newname' => $dst_name), 'affected_pages' => &$affected_pages, 'src_id' => $src, 'dst_id' => $dst);
     // give plugins the option to add their own meta files to the list of files that need to be moved
     // to the oldfiles/newfiles array or to adjust their own metadata, database, ...
     // and to add other pages to the affected pages
     $event = new Doku_Event('PLUGIN_MOVE_MEDIA_RENAME', $eventdata);
     if ($event->advise_before()) {
         /** @var helper_plugin_move_file $FileMover */
         $FileMover = plugin_load('helper', 'move_file');
         /** @var helper_plugin_move_rewrite $Rewriter */
         $Rewriter = plugin_load('helper', 'move_rewrite');
         // Move the Subscriptions & Indexes (new feature since Spring 2013 release)
         $Indexer = idx_get_indexer();
         if (($idx_msg = $Indexer->renameMetaValue('relation_media', $src, $dst)) !== true) {
             msg(sprintf($this->getLang('indexerror'), $idx_msg), -1);
             return false;
         }
         if (!$FileMover->moveMediaMeta($src_ns, $src_name, $dst_ns, $dst_name)) {
             msg(sprintf($this->getLang('mediametamoveerror'), $src), -1);
             return false;
         }
         // prepare directory
         io_createNamespace($dst, 'media');
         // move it FIXME this does not create a changelog entry!
         if (!io_rename(mediaFN($src), mediaFN($dst))) {
             msg(sprintf($this->getLang('mediamoveerror'), $src), -1);
             return false;
         }
         // clean up old ns
         io_sweepNS($src, 'mediadir');
         // Move the old revisions
         if (!$FileMover->moveMediaAttic($src_ns, $src_name, $dst_ns, $dst_name)) {
             // it's too late to stop the move, so just display a message.
             msg(sprintf($this->getLang('mediaatticmoveerror'), $src), -1);
         }
         // Add meta data to all affected pages, so links get updated later
         foreach ($affected_pages as $id) {
             $Rewriter->setMoveMeta($id, $src, $dst, 'media');
         }
     }
     $event->advise_after();
     // store this for later use
     $this->affectedPages = $affected_pages;
     return true;
 }
开发者ID:kochichi,项目名称:dokuwiki-plugin-move,代码行数:63,代码来源:op.php


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