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


PHP Solarium_Client::executeRequest方法代码示例

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


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

示例1: testExecuteRequestWithOverridingPlugin

 public function testExecuteRequestWithOverridingPlugin()
 {
     $request = new Solarium_Client_Request();
     $dummyOverride = 'dummyoverride';
     $observer = $this->getMock('Solarium_Plugin_Abstract', array(), array($this->_client, array()));
     $observer->expects($this->once())->method('preExecuteRequest')->with($this->equalTo($request))->will($this->returnValue($dummyOverride));
     $this->_client->registerPlugin('testplugin', $observer);
     $response = $this->_client->executeRequest($request);
     $this->assertEquals($dummyOverride, $response);
 }
开发者ID:realestateconz,项目名称:solarium,代码行数:10,代码来源:ClientTest.php

示例2: foreach

htmlHeader();
// This example shows how to manually execute the query flow.
// By doing this manually you can customize data in between any step (although a plugin might be better for this)
// And you can use only a part of the flow. You could for instance use the query object and request builder,
// but execute the request in your own code.
// create a client instance
$client = new Solarium_Client($config);
// create a select query instance
$query = $client->createSelect();
// manually create a request for the query
$request = $client->createRequest($query);
// you can now use the request object for getting an uri (ie. to use in you own code)
// or you could modify the request object
echo 'Request URI: ' . $request->getUri() . '<br/>';
// you can still execute the request using the client and get a 'raw' response object
$response = $client->executeRequest($request);
// and finally you can convert the response into a result
$result = $client->createResult($query, $response);
// display the total number of documents found by solr
echo 'NumFound: ' . $result->getNumFound();
// show documents using the resultset iterator
foreach ($result as $document) {
    echo '<hr/><table>';
    // the documents are also iterable, to get all fields
    foreach ($document as $field => $value) {
        // this converts multivalue fields to a comma-separated string
        if (is_array($value)) {
            $value = implode(', ', $value);
        }
        echo '<tr><th>' . $field . '</th><td>' . $value . '</td></tr>';
    }
开发者ID:swapnilphalak,项目名称:crawl-anywhere,代码行数:31,代码来源:5.1-partial-usage.php


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