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


PHP Apache_Solr_Document::setBoost方法代码示例

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


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

示例1: testClearReturnsDocumentToDefaultState

 public function testClearReturnsDocumentToDefaultState()
 {
     // set the document boost
     $this->_fixture->setBoost(0.5);
     // set a field
     $this->_fixture->someField = "some value";
     // clear the document to remove boost and fields
     $this->_fixture->clear();
     // document boost should now be false
     $this->assertFalse($this->_fixture->getBoost());
     // document fields should now be empty
     $this->assertEquals(0, count($this->_fixture->getFieldNames()));
     $this->assertEquals(0, count($this->_fixture->getFieldValues()));
     $this->assertEquals(0, count($this->_fixture->getFieldBoosts()));
     // document iterator should now be empty
     $this->assertEquals(0, iterator_count($this->_fixture));
 }
开发者ID:rande,项目名称:sfSolrPlugin,代码行数:17,代码来源:DocumentTest.php

示例2: dirname

<?php

require dirname(__FILE__) . '/../../bootstrap/unit.php';
$t = new limeade_test(2, limeade_output::get());
$t->diag('document format a document');
$document = new Apache_Solr_Document();
$document->setBoost(10);
$document->setField('sfl_guid', 'GUID_1234');
$document->setField('name', 'Thomas Rabaix', 1);
$document->setMultiValue('skills', 'php');
$document->setMultiValue('skills', 'symfony');
$document->addField('skills', 'objective-c');
$expected = array('name' => 'skills', 'value' => array(0 => 'php', 1 => 'symfony', 2 => 'objective-c'), 'boost' => false);
$t->cmp_ok($document->getField('skills'), '==', $expected, '::getField test multivalue setter');
$expected = array('name' => 'name', 'value' => 'Thomas Rabaix', 'boost' => 1);
$t->cmp_ok($document->getField('name'), '==', $expected, '::getField test setter');
开发者ID:rande,项目名称:sfSolrPlugin,代码行数:16,代码来源:apache_solr_document.php

示例3: testAddDocumentWithDocumentBoost

 public function testAddDocumentWithDocumentBoost()
 {
     // set a mock transport
     $mockTransport = $this->getMockHttpTransportInterface();
     // setup expected call and response
     $mockTransport->expects($this->once())->method('performPostRequest')->with($this->equalTo('http://localhost:8180/solr/update?wt=json'), $this->equalTo('<add allowDups="false" overwritePending="true" overwriteCommitted="true"><doc boost="2"><field name="guid">global unique id</field><field name="field">value</field></doc></add>'), $this->equalTo('text/xml; charset=UTF-8'), $this->equalTo(false))->will($this->returnValue(Apache_Solr_HttpTransport_ResponseTest::get200Response()));
     $fixture = new Apache_Solr_service();
     $fixture->setHttpTransport($mockTransport);
     $document = new Apache_Solr_Document();
     $document->setBoost(2);
     $document->guid = "global unique id";
     $document->field = "value";
     $fixture->addDocument($document);
 }
开发者ID:wanadev,项目名称:solr-php-client,代码行数:14,代码来源:ServiceTest.php

示例4: testAddDocumentWithDocumentBoost

 public function testAddDocumentWithDocumentBoost()
 {
     // set a mock transport
     $mockTransport = $this->getMockHttpTransportInterface();
     // setup expected call and response
     $mockTransport->expects($this->once())->method('performPostRequest')->will($this->returnValue(Apache_Solr_HttpTransport_ResponseTest::get200Response()));
     $fixture = new Apache_Solr_service();
     $fixture->setHttpTransport($mockTransport);
     $document = new Apache_Solr_Document();
     $document->setBoost(2);
     $document->guid = "global unique id";
     $document->field = "value";
     $fixture->addDocument($document);
 }
开发者ID:JCVI-Cloud,项目名称:METAREP,代码行数:14,代码来源:ServiceTest.php


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