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


PHP Solarium_Client::execute方法代码示例

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


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

示例1: testExecuteWithOverridingPlugin

 public function testExecuteWithOverridingPlugin()
 {
     $query = new Solarium_Query_Ping();
     $observer = $this->getMock('Solarium_Plugin_Abstract', array(), array($this->_client, array()));
     $observer->expects($this->once())->method('preExecute')->with($this->equalTo($query))->will($this->returnValue('dummyoverride'));
     $this->_client->registerPlugin('testplugin', $observer);
     $result = $this->_client->execute($query);
     $this->assertEquals('dummyoverride', $result);
 }
开发者ID:realestateconz,项目名称:solarium,代码行数:9,代码来源:ClientTest.php

示例2: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->input = $input;
     $this->output = $output;
     $parts = parse_url($input->getArgument('url'));
     $config = array('adapteroptions' => array('host' => $parts['host'], 'port' => isset($parts['port']) ? $parts['port'] : 80, 'path' => $parts['path']));
     $client = new \Solarium_Client($config);
     $ping = $client->createPing();
     $q_start = microtime(TRUE);
     $response = $client->execute($ping);
     $client_query_time = round((microtime(TRUE) - $q_start) * 1000, 1) . 'ms';
     $body = $response->getResponse()->getBody();
     if (!empty($body)) {
         $data = json_decode($body);
         $status = isset($data->status) ? $data->status : 'Unknown';
         $server_query_time = isset($data->responseHeader->QTime) ? $data->responseHeader->QTime . 'ms' : 'Unknown';
         $output->writeln("Ping status {$status} completed in (client/server) {$client_query_time}/{$server_query_time}");
     }
 }
开发者ID:danquah,项目名称:solr-tester,代码行数:19,代码来源:PingCommand.php

示例3: microtime

htmlHeader();
// create a client instance and autoload the customize request plugin
$client = new Solarium_Client($config);
$parallel = $client->getPlugin('parallelexecution');
// Add a delay param to better show the effect, as an example Solr install with
// only a dozen documents is too fast for good testing
// This param only works with the correct Solr plugin,
// see http://www.raspberry.nl/2012/01/04/solr-delay-component/
// If you don't have to plugin the example still works, just without the delay.
$customizer = $client->getPlugin('customizerequest');
$customizer->createCustomization(array('key' => 'delay', 'type' => 'param', 'name' => 'delay', 'value' => '500', 'persistent' => true));
// create two queries to execute in an array. Keys are important for fetching the results later!
$queryInstock = $client->createSelect()->setQuery('inStock:true');
$queryLowprice = $client->createSelect()->setQuery('price:[1 TO 300]');
// first execute the queries the normal way and time it
$start = microtime(true);
$client->execute($queryInstock);
$client->execute($queryLowprice);
echo 'Execution time for normal "serial" execution of two queries: ' . round(microtime(true) - $start, 3);
echo '<hr/>';
// now execute the two queries parallel and time it
$start = microtime(true);
$parallel->addQuery('instock', $queryInstock);
$parallel->addQuery('lowprice', $queryLowprice);
$results = $parallel->execute();
echo 'Execution time for parallel execution of two queries: ' . round(microtime(true) - $start, 3);
htmlFooter();
// Note: for this example on a default Solr index (with a tiny index) running on localhost the performance gain is
// minimal to none, sometimes even slightly slower!
// In a realworld scenario with network latency, a bigger dataset, more complex queries or multiple solr instances the
// performance gain is much more.
开发者ID:Bine0511,项目名称:RDF-Demo,代码行数:31,代码来源:7.4-plugin-parallelexecution.php


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