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