pax_global_header00006660000000000000000000000064121300731130014501gustar00rootroot0000000000000052 comment=f199745890879d2512dbcbff9d7e20c7e5e16a8e php-horde-elasticsearch-1.0.2/000077500000000000000000000000001213007311300161775ustar00rootroot00000000000000php-horde-elasticsearch-1.0.2/Horde_ElasticSearch-1.0.2/000077500000000000000000000000001213007311300224665ustar00rootroot00000000000000php-horde-elasticsearch-1.0.2/Horde_ElasticSearch-1.0.2/doc/000077500000000000000000000000001213007311300232335ustar00rootroot00000000000000php-horde-elasticsearch-1.0.2/Horde_ElasticSearch-1.0.2/doc/Horde/000077500000000000000000000000001213007311300242745ustar00rootroot00000000000000php-horde-elasticsearch-1.0.2/Horde_ElasticSearch-1.0.2/doc/Horde/ElasticSearch/000077500000000000000000000000001213007311300270065ustar00rootroot00000000000000php-horde-elasticsearch-1.0.2/Horde_ElasticSearch-1.0.2/doc/Horde/ElasticSearch/COPYING000066400000000000000000000024471213007311300300500ustar00rootroot00000000000000Copyright 2011-2013 Horde LLC (http://www.horde.org/). All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE HORDE PROJECT 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. php-horde-elasticsearch-1.0.2/Horde_ElasticSearch-1.0.2/doc/Horde/ElasticSearch/examples/000077500000000000000000000000001213007311300306245ustar00rootroot00000000000000php-horde-elasticsearch-1.0.2/Horde_ElasticSearch-1.0.2/doc/Horde/ElasticSearch/examples/add.php000066400000000000000000000012501213007311300320630ustar00rootroot00000000000000 * @license http://www.horde.org/licenses/bsd BSD * @category Horde * @package ElasticSearch */ require 'Horde/Autoloader/Default.php'; $client = new Horde_ElasticSearch_Client('http://localhost:9200/', new Horde_Http_Client()); $twitter = new Horde_ElasticSearch_Index('twitter', $client); $tweet = new Horde_ElasticSearch_Type('tweet', $twitter); var_dump($tweet->add(1, '{ "user": "kimchy", "post_date": "2009-11-15T13:12:00", "message": "Trying out elasticsearch, so far so good?" }')); php-horde-elasticsearch-1.0.2/Horde_ElasticSearch-1.0.2/doc/Horde/ElasticSearch/examples/count.php000066400000000000000000000010531213007311300324640ustar00rootroot00000000000000 * @license http://www.horde.org/licenses/bsd BSD * @category Horde * @package ElasticSearch */ require 'Horde/Autoloader/Default.php'; $client = new Horde_ElasticSearch_Client('http://localhost:9200/', new Horde_Http_Client()); $twitter = new Horde_ElasticSearch_Index('twitter', $client); $tweet = new Horde_ElasticSearch_Type('tweet', $twitter); var_dump($tweet->count()); php-horde-elasticsearch-1.0.2/Horde_ElasticSearch-1.0.2/doc/Horde/ElasticSearch/examples/get.php000066400000000000000000000010531213007311300321130ustar00rootroot00000000000000 * @license http://www.horde.org/licenses/bsd BSD * @category Horde * @package ElasticSearch */ require 'Horde/Autoloader/Default.php'; $client = new Horde_ElasticSearch_Client('http://localhost:9200/', new Horde_Http_Client()); $twitter = new Horde_ElasticSearch_Index('twitter', $client); $tweet = new Horde_ElasticSearch_Type('tweet', $twitter); var_dump($tweet->get(1)); php-horde-elasticsearch-1.0.2/Horde_ElasticSearch-1.0.2/doc/Horde/ElasticSearch/examples/map.php000066400000000000000000000011601213007311300321100ustar00rootroot00000000000000 * @license http://www.horde.org/licenses/bsd BSD * @category Horde * @package ElasticSearch */ require 'Horde/Autoloader/Default.php'; $client = new Horde_ElasticSearch_Client('http://localhost:9200/', new Horde_Http_Client()); $twitter = new Horde_ElasticSearch_Index('twitter', $client); $user = new Horde_ElasticSearch_Type('user', $twitter); var_dump($user->map('{ "properties" : { "name" : { "type" : "string" } } }')); php-horde-elasticsearch-1.0.2/Horde_ElasticSearch-1.0.2/doc/Horde/ElasticSearch/examples/search.php000066400000000000000000000010711213007311300326010ustar00rootroot00000000000000 * @license http://www.horde.org/licenses/bsd BSD * @category Horde * @package ElasticSearch */ require 'Horde/Autoloader/Default.php'; $client = new Horde_ElasticSearch_Client('http://localhost:9200/', new Horde_Http_Client()); $twitter = new Horde_ElasticSearch_Index('twitter', $client); $tweet = new Horde_ElasticSearch_Type('tweet', $twitter); var_dump($tweet->search('elasticsearch')); php-horde-elasticsearch-1.0.2/Horde_ElasticSearch-1.0.2/doc/Horde/ElasticSearch/examples/status.php000066400000000000000000000010251213007311300326560ustar00rootroot00000000000000 * @license http://www.horde.org/licenses/bsd BSD * @category Horde * @package ElasticSearch */ require 'Horde/Autoloader/Default.php'; $client = new Horde_ElasticSearch_Client('http://localhost:9200/', new Horde_Http_Client()); var_dump($client->status()); $twitter = new Horde_ElasticSearch_Index('twitter', $client); var_dump($twitter->status()); php-horde-elasticsearch-1.0.2/Horde_ElasticSearch-1.0.2/lib/000077500000000000000000000000001213007311300232345ustar00rootroot00000000000000php-horde-elasticsearch-1.0.2/Horde_ElasticSearch-1.0.2/lib/Horde/000077500000000000000000000000001213007311300242755ustar00rootroot00000000000000php-horde-elasticsearch-1.0.2/Horde_ElasticSearch-1.0.2/lib/Horde/ElasticSearch/000077500000000000000000000000001213007311300270075ustar00rootroot00000000000000php-horde-elasticsearch-1.0.2/Horde_ElasticSearch-1.0.2/lib/Horde/ElasticSearch/Client.php000066400000000000000000000045621213007311300307450ustar00rootroot00000000000000 * @license http://www.horde.org/licenses/bsd BSD * @category Horde * @package ElasticSearch */ class Horde_ElasticSearch_Client { protected $_server = 'http://localhost:9200/'; protected $_httpClient; public function __construct($server, Horde_Http_Client $httpClient) { $this->_server = $server; $this->_httpClient = $httpClient; } /** * curl -X GET {SERVER}/_status */ public function status($index = null) { return $this->_request($this->_path($index, '_status')); } /** * curl -X GET {SERVER}/{INDEX}/{TYPE}/_search?q= ... */ public function search($index, $type, $q) { return $this->_request($this->_path($index, $type, '_search') . '?' . http_build_query(array('q' => $q))); } /** * curl -X GET {SERVER}/{INDEX}/{TYPE/{ID} */ public function get($index, $type, $id) { return $this->_request($this->_path($index, $type, $id)); } /** * curl -X PUT {SERVER}/{INDEX}/{TYPE}/{ID} -d ... */ public function add($index, $type, $id, $data) { return $this->_request($this->_path($index, $type, $id), 'PUT', $data); } /** * curl -X GET {SERVER}/{INDEX}/{TYPE}/_count -d {matchAll:{}} */ public function count($index, $type) { return $this->_request($this->_path($index, $type, '_count'), 'GET', '{ matchAll:{} }'); } /** * curl -X PUT {SERVER}/{INDEX}/{TYPE}/_mapping -d ... */ public function map($index, $type, $data) { return $this->_request($this->_path($index, $type, '_mapping'), 'PUT', $data); } protected function _request($path, $method = 'GET', $data = null, $headers = array()) { try { $result = $this->_httpClient->request($method, $this->_server . $path, $data, $headers); return json_decode($result->getBody()); } catch (Horde_Http_Exception $e) { throw new Horde_ElasticSearch_Exception($e->getMessage(), $e->getCode(), $e); } } protected function _path() { $path = array_filter(func_get_args()); foreach ($path as &$element) { $element = urlencode($element); } return implode('/', $path); } } php-horde-elasticsearch-1.0.2/Horde_ElasticSearch-1.0.2/lib/Horde/ElasticSearch/Exception.php000066400000000000000000000004711213007311300314600ustar00rootroot00000000000000 * @license http://www.horde.org/licenses/bsd BSD * @category Horde * @package ElasticSearch */ class Horde_ElasticSearch_Exception extends Horde_Exception { } php-horde-elasticsearch-1.0.2/Horde_ElasticSearch-1.0.2/lib/Horde/ElasticSearch/Index.php000066400000000000000000000036561213007311300306010ustar00rootroot00000000000000 * @license http://www.horde.org/licenses/bsd BSD * @category Horde * @package ElasticSearch */ class Horde_ElasticSearch_Index { protected $_client; protected $_index; public function __construct($index, Horde_ElasticSearch_Client $client) { $this->_index = $index; $this->_client = $client; } /** * curl -X PUT {SERVER}/{INDEX}/ */ public function create() { $this->_client->request(null, 'PUT'); } /** * curl -X DELETE {SERVER}/{INDEX}/ */ public function drop() { $this->_client->request(null, 'DELETE'); } /** * curl -X GET {SERVER}/{INDEX}/_status */ public function status() { return $this->_client->status($this->_index); } /** * curl -X GET {SERVER}/{INDEX}/{TYPE}/_search?q= ... */ public function search($type, $q) { return $this->_client->search($this->_index, $type, $q); } /** * curl -XGET {SERVER}/{INDEX}/{TYPE/{ID} */ public function get($type, $id) { return $this->_client->get($this->_index, $type, $id); } /** * curl -X PUT {SERVER}/{INDEX}/{TYPE}/{ID} -d ... */ public function add($type, $id, $data) { return $this->_client->add($this->_index, $type, $id, $data); } /** * curl -X GET {SERVER}/{INDEX}/{TYPE}/_count -d {matchAll:{}} */ public function count($type) { return $this->_client->count($this->_index, $type); } /** * curl -X PUT {SERVER}/{INDEX}/{TYPE}/_mapping -d ... */ public function map($type, $data) { return $this->_client->map($this->_index, $type, $data); return $this->call($type . '/_mapping', array('method' => 'PUT', 'content' => $data)); } } php-horde-elasticsearch-1.0.2/Horde_ElasticSearch-1.0.2/lib/Horde/ElasticSearch/Type.php000066400000000000000000000024741213007311300304500ustar00rootroot00000000000000 * @license http://www.horde.org/licenses/bsd BSD * @category Horde * @package ElasticSearch */ class Horde_ElasticSearch_Type { protected $_type; protected $_index; public function __construct($type, Horde_ElasticSearch_Index $index) { $this->_type = $type; $this->_index = $index; } /** * curl -X GET {SERVER}/{INDEX}/{TYPE}/_search?q= ... */ public function search($q) { return $this->_index->search($this->_type, $q); } /** * curl -XGET {SERVER}/{INDEX}/{TYPE/{ID} */ public function get($id) { return $this->_index->get($this->_type, $id); } /** * curl -X PUT {SERVER}/{INDEX}/{TYPE}/{ID} -d ... */ public function add($id, $data) { return $this->_index->add($this->_type, $id, $data); } /** * curl -X GET {SERVER}/{INDEX}/{TYPE}/_count -d {matchAll:{}} */ public function count() { return $this->_index->count($this->_type); } /** * curl -X PUT {SERVER}/{INDEX}/{TYPE}/_mapping -d ... */ public function map($data) { return $this->_index->map($this->_type, $data); } } php-horde-elasticsearch-1.0.2/package.xml000066400000000000000000000135541213007311300203240ustar00rootroot00000000000000 Horde_ElasticSearch pear.horde.org Horde ElasticSearch client Lightweight API for ElasticSearch (http://www.elasticsearch.org/). Chuck Hagenbuch chuck chuck@horde.org yes Jan Schneider jan jan@horde.org yes 2013-03-05 1.0.2 1.0.0 stable stable BSD-2-Clause * [rla] Add license file. 5.3.0 1.7.0 Horde_Exception pear.horde.org 2.0.0 3.0.0alpha1 3.0.0alpha1 Horde_Http pear.horde.org 2.0.0 3.0.0alpha1 3.0.0alpha1 2012-07-22 1.0.0beta1 1.0.0beta1 beta beta BSD-2-Clause * First beta release for Horde 5. 1.0.0beta2 1.0.0beta1 beta beta 2012-07-22 BSD-2-Clause * [jan] Fix dependency on Horde_Http. 1.0.0 1.0.0 stable stable 2012-10-30 BSD-2-Clause * First stable release for Horde 5. 1.0.1 1.0.0 stable stable 2012-11-19 BSD-2-Clause * [mms] Use new Horde_Test layout. 1.0.2 1.0.0 stable stable 2013-03-05 BSD-2-Clause * [rla] Add license file.