當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。