예제 #1
0
/**
 * Instantiates a Solr Client
 * @return Client
 */
function elgg_solr_get_client()
{
    static $client;
    if ($client) {
        return $client;
    }
    Autoloader::register();
    $options = elgg_solr_get_adapter_options();
    $config = array('endpoint' => array('localhost' => $options));
    // create a client instance
    $client = new Client($config);
    return $client;
}
예제 #2
0
파일: stub.php 프로젝트: starsw001/solarium
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 *
 * The views and conclusions contained in the software and documentation are
 * those of the authors and should not be interpreted as representing official
 * policies, either expressed or implied, of the copyright holder.
 *
 * @copyright Copyright 2012 Bas de Nooijer <*****@*****.**>
 * @license http://github.com/basdenooijer/solarium/raw/master/COPYING
 * @link http://www.solarium-project.org/
 */
Phar::mapPhar("solarium.phar");
require_once 'phar://solarium.phar/vendor/autoload.php';
\Solarium\Autoloader::register();
if ('cli' === php_sapi_name() && basename(__FILE__) === basename($_SERVER['argv'][0]) && isset($_SERVER['argv'][1])) {
    switch ($_SERVER['argv'][1]) {
        case 'version':
            echo "Solarium version " . \Solarium\Client::VERSION . "\n";
            break;
        default:
            echo 'Unknown command \'' . $_SERVER['argv'][1] . '\' (Supported commands: version)' . "\n";
    }
}
__halt_compiler();