本文整理汇总了PHP中Apache_Solr_Document::setFieldBoost方法的典型用法代码示例。如果您正苦于以下问题:PHP Apache_Solr_Document::setFieldBoost方法的具体用法?PHP Apache_Solr_Document::setFieldBoost怎么用?PHP Apache_Solr_Document::setFieldBoost使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Apache_Solr_Document
的用法示例。
在下文中一共展示了Apache_Solr_Document::setFieldBoost方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testSetAndGetFieldBoostWithNonNumberRemovesBoost
public function testSetAndGetFieldBoostWithNonNumberRemovesBoost()
{
$field = 'field';
$boost = "i am not a number";
$this->_fixture->setFieldBoost($field, $boost);
// test the field boost
$this->assertTrue($this->_fixture->getFieldBoost($field) === false);
}
示例2: testExtractsWithDocument
public function testExtractsWithDocument()
{
$extractFile = __FILE__;
$expectedUrl = "http://localhost:8180/solr/update/extract?resource.name=ServiceTest.php&wt=json&json.nl=map&boost.field=2&literal.field=literal+value";
$expectedPostData = file_get_contents($extractFile);
$expectedContentType = 'application/octet-stream';
// default for extract
$expectedTimeout = false;
// set a mock transport
$mockTransport = $this->getMockHttpTransportInterface();
// setup expected call and response
$mockTransport->expects($this->once())->method('performPostRequest')->with($this->equalTo($expectedUrl), $this->equalTo($expectedPostData), $this->equalTo($expectedContentType), $this->equalTo($expectedTimeout))->will($this->returnValue(Apache_Solr_HttpTransport_ResponseTest::get200Response()));
$fixture = new Apache_Solr_Service();
$fixture->setHttpTransport($mockTransport);
$literals = new Apache_Solr_Document();
$literals->field = "literal value";
$literals->setFieldBoost('field', 2);
$fixture->extract($extractFile, null, $literals);
}