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


PHP Lucene::create方法代码示例

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


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

示例1: get

 /**
  * @returns \Zend\Search\Lucene\SearchIndexInterface
  */
 public function get()
 {
     if (!$this->checkEsists()) {
         return Lucene::create($this->path);
     } else {
         return Lucene::open($this->path);
     }
 }
开发者ID:risinglf,项目名称:UniversiBO,代码行数:11,代码来源:LuceneFactory.php

示例2: testHtmlInlineTagsIndexing

 /**
  * @group ZF-4252
  */
 public function testHtmlInlineTagsIndexing()
 {
     $index = Lucene\Lucene::create(__DIR__ . '/_index/_files');
     $htmlString = '<html><head><title>Hello World</title></head>' . '<body><b>Zend</b>Framework' . "\n" . ' <div>Foo</div>Bar ' . "\n" . ' <strong>Test</strong></body></html>';
     $doc = Document\Html::loadHTML($htmlString);
     $index->addDocument($doc);
     $hits = $index->find('FooBar');
     $this->assertEquals(count($hits), 0);
     $hits = $index->find('ZendFramework');
     $this->assertEquals(count($hits), 1);
     unset($index);
     $this->_clearDirectory(__DIR__ . '/_index/_files');
 }
开发者ID:robertodormepoco,项目名称:zf2,代码行数:16,代码来源:DocumentTest.php

示例3: testIsDeletedWithoutExplicitCommit

 /**
  * @group ZF-9680
  */
 public function testIsDeletedWithoutExplicitCommit()
 {
     $index = Lucene\Lucene::create(__DIR__ . '/_index/_files');
     $document = new Document();
     $document->addField(Document\Field::Keyword('_id', 'myId'));
     $document->addField(Document\Field::Keyword('bla', 'blubb'));
     $index->addDocument($document);
     $this->assertFalse($index->isDeleted(0));
 }
开发者ID:rikaix,项目名称:zf2,代码行数:12,代码来源:IndexTest.php

示例4: testTermsStreamInterfaceSkipToTermsRetrievingTwoTermsCase

 public function testTermsStreamInterfaceSkipToTermsRetrievingTwoTermsCase()
 {
     $index = Lucene\Lucene::create(dirname(__FILE__) . '/_index/_files');
     // Zero terms
     $doc = new Document\Document();
     $doc->addField(Document\Field::Text('contents', 'someterm word'));
     $index->addDocument($doc);
     unset($index);
     $index = Lucene\Lucene::open(dirname(__FILE__) . '/_index/_files');
     $index->resetTermsStream();
     $index->skipTo(new Index\Term('term', 'contents'));
     $this->assertTrue($index->currentTerm() == new Index\Term('word', 'contents'));
     $index->closeTermsStream();
     $this->_clearDirectory(dirname(__FILE__) . '/_index/_files');
 }
开发者ID:bradley-holt,项目名称:zf2,代码行数:15,代码来源:IndexTest.php

示例5: run

    /**
     * Transforms given objects into a bulk add operation directive
     *
     * @param ClassMetadata $metadata
     * @param array $objects
     * @param array bulk commands
     */
    public function run(ClassMetadata $metadata)
    {
        $index = $metadata->getIndex()->getName();

        Lucene::create("/tmp/index_$index");
    }
开发者ID:nresni,项目名称:Ariadne,代码行数:13,代码来源:CreateIndex.php


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