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


PHP Lucene::open方法代码示例

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


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

 /**
  * @covers Zend\Search\Lucene\MultiSearcher::find
  * @covers Zend\Search\Lucene\Search\QueryHit::getDocument
  */
 public function testFind()
 {
     $index = new Lucene\MultiSearcher(array(Lucene\Lucene::open(__DIR__ . '/_indexSample/_files'), Lucene\Lucene::open(__DIR__ . '/_indexSample/_files')));
     $hits = $index->find('submitting');
     $this->assertEquals(count($hits), 2 * 3);
     foreach ($hits as $hit) {
         $document = $hit->getDocument();
         $this->assertTrue($document instanceof Lucene\Document);
     }
 }
开发者ID:robertodormepoco,项目名称:zf2,代码行数:14,代码来源:MultiIndexTest.php

示例3: 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, array $objects)
    {
        $index = $metadata->getIndex()->getName();

        $index = Lucene::open("/tmp/index_$index");

        foreach ($objects as $object) {
            $document = $this->exportObject($metadata, $object);
            $index->addDocument($document);
        }
    }
开发者ID:nresni,项目名称:Ariadne,代码行数:18,代码来源:AddToIndex.php

示例4: run

    /**
     * (non-PHPdoc)
     * @see Ariadne\Engine.Engine::search()
     */
    public function run(ClassMetadata $metadata, Query $query)
    {
        $index = $metadata->getIndex()->getName();

        $type = $metadata->getClassName();

        $arguments = $this->mapQuery($query);

        $index = Lucene::open("/tmp/index_$index");

        $result = call_user_func_array(array($index, 'find'), $arguments);

        return $this->mapResult($result, $metadata, $query);
    }
开发者ID:nresni,项目名称:Ariadne,代码行数:18,代码来源:SearchIndex.php

示例5: testLimitingResult

 public function testLimitingResult()
 {
     $index = Lucene\Lucene::open(dirname(__FILE__) . '/_index23Sample/_files');
     $storedResultSetLimit = Lucene\Lucene::getResultSetLimit();
     Lucene\Lucene::setResultSetLimit(3);
     $hits = $index->find('"reporting bugs"', 'path');
     $this->assertEquals(count($hits), 3);
     $expectedResultset = array(array(7, 0.212395, 'IndexSource/contributing.bugs.html'), array(0, 0.247795, 'IndexSource/contributing.documentation.html'), array(2, 0.176996, 'IndexSource/contributing.patches.html'));
     foreach ($hits as $resId => $hit) {
         $this->assertEquals($hit->id, $expectedResultset[$resId][0]);
         $this->assertTrue(abs($hit->score - $expectedResultset[$resId][1]) < 1.0E-6);
         $this->assertEquals($hit->path, $expectedResultset[$resId][2]);
     }
     Lucene\Lucene::setResultSetLimit($storedResultSetLimit);
 }
开发者ID:bradley-holt,项目名称:zf2,代码行数:15,代码来源:Search23Test.php

示例6: testTermsStreamInterfaceSkipToTermsRetrievingTwoTermsCase

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


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