2017 © Pedro Peláez
 

library solrclient

Client for Apache Solr

image

opendi/solrclient

Client for Apache Solr

  • Friday, April 28, 2017
  • by ihabunek
  • Repository
  • 8 Watchers
  • 2 Stars
  • 1,656 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 21 Versions
  • 0 % Grown

The README.md

solrclient

Classes for the busy PHP developer to work with Apache Solr., (*1)

Circle CI Packagist License, (*2)

Requirements

This package requires at least PHP 5.5.9., (*3)

Construction

First, you must construct a Guzzle HTTP client and set the base_uri option to the Solr endpoint you wish to work with. Then use it to create a Solr Client., (*4)

use Opendi\Solr\Client\Client;

$guzzle = new \GuzzleHttp\Client([
    'base_uri' => "http://localhost:8983/solr/"
]);

$client = new Client($guzzle);

It's also possible to pass some default request options, such as headers and timeouts to the Guzzle client., (*5)

use Opendi\Solr\Client\Client;

$guzzle = new \GuzzleHttp\Client([
    'base_uri' => "http://localhost:8983/solr/",
    'defaults' => [
        'timeout' => 10
    ]
]);

$solr = new Client($guzzle);

See Guzzle documentation for all options., (*6)

There is a helper factory($url, $defaults) static method which does the same as above., (*7)

use Opendi\Solr\Client\Client;

$solr = Client::factory('http://localhost:8983/solr/', [
    'timeout' => 10
]);

Working with cores

A core is solar terminology for a collection of records. To select a core, use the core($name) method on the Solr Client., (*8)

$core = $client->core('places');

// Perform a select query
$select = Solr::select()->search('name:Franz');
$client->core('places')->select($select);

// Perform an update query
$update = Solr::update()->body('{}');
$client->core('places')->update($update);

The Core object offers some helper methods:, (*9)

// Returns core status
$client->core('places')->status();

// Returns number of documents in a core
$client->core('places')->count();

// Deletes all records in the core
$client->core('places')->deleteAll();

// Deletes records matching a selector
$client->core('places')->deleteByQuery('name:Opendi');

// Deletes record with the given ID
$client->core('places')->deleteByID('100');

// Checks the core is up
$client->core('places')->ping();

// Optimizes core documents
$client->core('places')->optimize();

// Commits inserted documents
$client->core('places')->commit();

The Versions

14/07 2015
14/07 2015
09/07 2015

dev-feature/reorganization

dev-feature/reorganization https://github.com/opendi/solrclient

Client for Apache Solr

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

solr

25/08 2014

0.3.2

0.3.2.0 https://github.com/opendi/solrclient

Client for Apache Solr

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

solr

25/06 2014

0.3.1

0.3.1.0 https://github.com/opendi/solrclient

Client for Apache Solr

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

solr

23/06 2014

0.3.0

0.3.0.0 https://github.com/opendi/solrclient

Client for Apache Solr

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

solr

11/06 2014

0.2.1

0.2.1.0 https://github.com/opendi/solrclient

Client for Apache Solr

  Sources   Download

The Requires

 

The Development Requires

solr

12/05 2014

0.2

0.2.0.0 https://github.com/opendi/solrclient

Client for Apache Solr

  Sources   Download

The Requires

 

The Development Requires

solr

11/04 2014

0.1

0.1.0.0 https://github.com/opendi/solrclient

Client for Apache Solr

  Sources   Download

The Requires

  • php >=5.4.0

 

The Development Requires

solr