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


PHP Solarium_Client::getAdapter方法代码示例

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


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

示例1: testBlockedQueryTypeNotLoadbalanced

 public function testBlockedQueryTypeNotLoadbalanced()
 {
     $originalHost = $this->_client->getAdapter()->getHost();
     $servers = array('s1' => array('options' => $this->_serverOptions, 'weight' => 100), 's2' => array('options' => $this->_serverOptions, 'weight' => 1));
     $this->_plugin->setServers($servers);
     $request = new Solarium_Client_Request();
     $query = new Solarium_Query_Update();
     // this is a blocked querytype that should not be loadbalanced
     $this->_plugin->preCreateRequest($query);
     $this->_plugin->preExecuteRequest($request);
     $this->assertEquals($originalHost, $this->_client->getAdapter()->getHost());
     $this->assertEquals(null, $this->_plugin->getLastServerKey());
 }
开发者ID:Bine0511,项目名称:RDF-Demo,代码行数:13,代码来源:LoadbalancerTest.php

示例2: getSolr

 /** Get the solr object for querying cores
  * @access public
  * @return \Solarium_Client
  */
 public function getSolr()
 {
     $this->_solr = new Solarium_Client($this->getSolrConfig());
     $this->_solr->setAdapter('Solarium_Client_Adapter_ZendHttp');
     $this->_solr->getAdapter()->getZendHttp();
     $loadbalancer = $this->_solr->getPlugin('loadbalancer');
     $master = $this->getConfig()->solr->master->toArray();
     $asgard = $this->getConfig()->solr->asgard->toArray();
     $valhalla = $this->getConfig()->solr->valhalla->toArray();
     $loadbalancer->addServer('objects', $master, 100);
     $loadbalancer->addServer('asgard', $asgard, 200);
     $loadbalancer->addServer('valhalla', $valhalla, 150);
     $loadbalancer->setFailoverEnabled(true);
     $this->_solr->getAdapter()->getZendHttp();
     $this->_loadbalancer = $loadbalancer;
     return $this->_solr;
 }
开发者ID:lesleyauk,项目名称:findsorguk,代码行数:21,代码来源:Handler.php

示例3: testSetAndGetAdapterWithObject

 public function testSetAndGetAdapterWithObject()
 {
     $adapterClass = 'MyAdapter';
     $this->_client->setAdapter(new $adapterClass());
     $this->assertThat($this->_client->getAdapter(), $this->isInstanceOf($adapterClass));
 }
开发者ID:realestateconz,项目名称:solarium,代码行数:6,代码来源:ClientTest.php

示例4: foreach

<?php

require_once 'Zend/Loader/Autoloader.php';
$loader = Zend_Loader_Autoloader::getInstance();
require 'init.php';
htmlHeader();
// create a client instance
$client = new Solarium_Client($config);
// set the adapter to zendhttp and get a zendhttp client instance reference
$client->setAdapter('Solarium_Client_Adapter_ZendHttp');
$zendHttp = $client->getAdapter()->getZendHttp();
// you can use any of the zend_http features, like http-authentication
$zendHttp->setAuth('user', 'password!', Zend_Http_Client::AUTH_BASIC);
// get a select query instance
$query = $client->createSelect();
// this executes the query and returns the result
$resultset = $client->select($query);
// display the total number of documents found by solr
echo 'NumFound: ' . $resultset->getNumFound();
// show documents using the resultset iterator
foreach ($resultset 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>';
    }
    echo '</table>';
开发者ID:swapnilphalak,项目名称:crawl-anywhere,代码行数:31,代码来源:6.1.1-zend-http-adapter.php


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