本文整理汇总了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);
}
}
示例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');
}
示例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));
}
示例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');
}
示例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");
}