Tarea #836 -> Búsqueda sobre los ficheros de CV
git-svn-id: https://192.168.0.254/svn/Proyectos.Incam_Intranet/trunk@128 e2b1556b-49f8-d141-9351-52d6861a72d9
This commit is contained in:
parent
cf07c10321
commit
dfadd4772e
@ -173,8 +173,6 @@ return $resultado;
|
||||
* Otro - Excepción
|
||||
*/
|
||||
$sesion = $this->usuario->getValor("oid");
|
||||
echo $this->usuario->tieneRol(1);
|
||||
echo $this->usuario->tieneRol(4);
|
||||
if ($this->usuario->tieneRol(1) || $this->usuario->tieneRol(4)) {
|
||||
parent::removeCurriculum($curriculum, $fecha, $this->usuario->getValor("nombre"));
|
||||
} else {
|
||||
|
||||
@ -10,6 +10,7 @@
|
||||
include_once("BD.php");
|
||||
include_once("Rol.php");
|
||||
include_once("Objects/Administracion.php");
|
||||
include_once("functions_solr.php");
|
||||
|
||||
class Persona{
|
||||
|
||||
@ -715,13 +716,15 @@
|
||||
$nombre_ruta_tabla=addslashes($nombre_ruta_tabla);
|
||||
|
||||
if($fichero_subido){
|
||||
$bd = new BD();
|
||||
$consulta = "INSERT INTO curriculum_usuario (oid, curriculum, fecha) values ('".$oid."', '".$nombre_ruta_tabla."', now())";
|
||||
$bd->execQuery($consulta);
|
||||
$bd = new BD();
|
||||
$consulta = "INSERT INTO curriculum_usuario (oid, curriculum, fecha) values ('".$oid."', '".$nombre_ruta_tabla."', now())";
|
||||
$bd->execQuery($consulta);
|
||||
//$this->actualizarHistorial("Nuevo CV", $usuario);
|
||||
$consulta = "update usuarios set cv=cv+1 where oid='$oid'";
|
||||
$bd->execQuery($consulta);
|
||||
return true;
|
||||
$consulta = "update usuarios set cv=cv+1 where oid='$oid'";
|
||||
$bd->execQuery($consulta);
|
||||
|
||||
solr_anadir_cv($oid, $destino);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -732,21 +735,20 @@
|
||||
$consulta = "DELETE FROM curriculum_usuario WHERE oid = '".$oid."' and curriculum = '".$curriculum."' and fecha = '".$fecha."'";
|
||||
$bd = new BD();
|
||||
$resultado = $bd->execQuery($consulta);
|
||||
|
||||
if ($resultado){
|
||||
if ($resultado){
|
||||
$consulta = "update usuarios set cv=cv-1 where oid='$oid'";
|
||||
$bd->execQuery($consulta);
|
||||
|
||||
$cambios = "CV eliminado";
|
||||
|
||||
//$this->actualizarHistorial($cambios, $usuario);
|
||||
$ruta = constante("srcDocs")."\\".$curriculum;
|
||||
if (!@unlink($ruta)){
|
||||
return false;
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
|
||||
$bd->execQuery($consulta);
|
||||
$cambios = "CV eliminado";
|
||||
//$this->actualizarHistorial($cambios, $usuario);
|
||||
|
||||
$ruta = constante("srcDocs")."\\".$curriculum;
|
||||
if (is_file($ruta) && unlink($ruta))
|
||||
{
|
||||
solr_eliminar_cv($ruta);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
27
src/anadir_todos_cv.php
Normal file
27
src/anadir_todos_cv.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
include_once("seguridad.php");
|
||||
include_once("functions_solr.php");
|
||||
|
||||
echo "Añadiendo todos los CV a Apache Solr...".PHP_EOL;
|
||||
$directorio = constante("srcDocs").SLASH."cv".SLASH;
|
||||
if (!@file_exists($directorio)){
|
||||
return false;
|
||||
}
|
||||
|
||||
$ficheros_cv = scandir($directorio);
|
||||
foreach ($ficheros_cv as $fichero) {
|
||||
if ($fichero != "." && $fichero != "..") {
|
||||
echo $fichero.PHP_EOL;
|
||||
$oid = explode("-", $fichero);
|
||||
try {
|
||||
solr_anadir_cv($oid[0], $directorio.$fichero);
|
||||
}
|
||||
catch(Exception $e) {
|
||||
dbug('Message: ' .$e->getMessage());
|
||||
echo dbug('print');
|
||||
}
|
||||
}
|
||||
}
|
||||
echo "Terminado.".PHP_EOL;
|
||||
|
||||
?>
|
||||
@ -5,7 +5,7 @@ include("functions.php");
|
||||
include_once("Objects/Candidato.php");
|
||||
|
||||
$oid = stripinput($_GET["oid"]);
|
||||
$curriculum = stripinput($_GET["curriculum"]);
|
||||
$curriculum = $_GET["curriculum"];
|
||||
$fecha = stripinput($_GET["fecha"]);
|
||||
$tipo = stripinput($_GET["tipo"]);
|
||||
|
||||
|
||||
16
src/borrar_todos_cv.php
Normal file
16
src/borrar_todos_cv.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
include_once("seguridad.php");
|
||||
include_once("functions_solr.php");
|
||||
|
||||
echo "Borrar todos los CV de Apache Solr...".PHP_EOL;
|
||||
|
||||
try {
|
||||
solr_eliminar_todo();
|
||||
}
|
||||
catch(Exception $e) {
|
||||
dbug('Message: ' .$e->getMessage());
|
||||
echo dbug('print');
|
||||
}
|
||||
echo "Terminado.".PHP_EOL;
|
||||
|
||||
?>
|
||||
@ -62,9 +62,15 @@ if ((isset($_POST['buscar'])) || (isset($_GET['byEstado']))) {
|
||||
if ($whereCampos != "") {
|
||||
$whereCampos = $whereCampos . " or ";
|
||||
}
|
||||
$whereCampos = $whereCampos . "usuarios.". $campo ." like '%". $palabra ."%'";
|
||||
if ($campo == "cv") {
|
||||
$ids = solr_buscar_palabra($palabra);
|
||||
$whereCampos .= "usuarios.oid in (".implode(",", $ids).")";
|
||||
}
|
||||
else {
|
||||
$whereCampos = $whereCampos . "usuarios.". $campo ." like '%". $palabra ."%'";
|
||||
}
|
||||
}
|
||||
if (($palabra != "") && ($whereCampos == "")) {
|
||||
if (($palabra != "") && (count($campos) == 0)) {
|
||||
$errores = $locale['01903'];
|
||||
}
|
||||
|
||||
@ -133,10 +139,9 @@ $_SESSION['tecnologias']=$tecnologias;
|
||||
if ($whereTecnologias != "")
|
||||
$query = $query . " and (". $whereTecnologias .")";
|
||||
|
||||
//Metemos la ordenacion deseada
|
||||
$query = $query. $order_by;
|
||||
|
||||
//echo $query;
|
||||
//Metemos la ordenacion deseada
|
||||
$query = $query. $order_by;
|
||||
//echo $query;
|
||||
$listaCandidatos=new ListaCandidatos($usuario,"",$query,"");
|
||||
}
|
||||
}
|
||||
@ -177,7 +182,9 @@ while($row = mysql_fetch_row($resultado)) {
|
||||
}
|
||||
}
|
||||
?>
|
||||
<option <?php echo (in_array('cv', $_POST['campo'])) ? "selected" : ""; ?> value="cv"><?php echo $locale['5108']; ?></option>
|
||||
</select>
|
||||
|
||||
</td>
|
||||
</tr></table>
|
||||
<input type="submit" value="Buscar" name="buscar">
|
||||
|
||||
82
src/functions_solr.php
Normal file
82
src/functions_solr.php
Normal file
@ -0,0 +1,82 @@
|
||||
<?php
|
||||
require_once('vendor/SolrPhpClient/Apache/Solr/Service.php');
|
||||
require_once('functions_sistema.php');
|
||||
|
||||
function solr_anadir_cv($oid, $filename) {
|
||||
|
||||
$ext = pathinfo($filename, PATHINFO_EXTENSION);
|
||||
$ext = ".".$ext;
|
||||
$nombre = basename($filename, $ext);
|
||||
|
||||
$solr = new Apache_Solr_Service('localhost', 8983, '/solr/');
|
||||
if ($solr->ping())
|
||||
{
|
||||
$document = new Apache_Solr_Document();
|
||||
$document->id = $nombre;
|
||||
|
||||
$params = array(
|
||||
'resource.name' => basename($filename),
|
||||
'literal.id' => $nombre,
|
||||
'literal.candidato' => $oid,
|
||||
'uprefix' => 'attr_',
|
||||
'fmap.content' => 'attr_content',
|
||||
);
|
||||
|
||||
$solr->extract($filename, $params, $document);
|
||||
$solr->commit();
|
||||
$solr->optimize();
|
||||
}
|
||||
}
|
||||
|
||||
function solr_eliminar_cv($filename) {
|
||||
$ext = pathinfo($filename, PATHINFO_EXTENSION);
|
||||
$ext = ".".$ext;
|
||||
$nombre = basename($filename, $ext);
|
||||
|
||||
$solr = new Apache_Solr_Service('localhost', 8983, '/solr/');
|
||||
if ($solr->ping())
|
||||
{
|
||||
$solr->deleteById($nombre);
|
||||
$solr->commit();
|
||||
}
|
||||
}
|
||||
|
||||
function solr_eliminar_todo() {
|
||||
$solr = new Apache_Solr_Service('localhost', 8983, '/solr/');
|
||||
if ($solr->ping())
|
||||
{
|
||||
$solr->deleteByQuery('id:*');
|
||||
$solr->commit();
|
||||
}
|
||||
}
|
||||
|
||||
function solr_buscar_palabra($palabra) {
|
||||
$ids = array();
|
||||
$query = $palabra;
|
||||
if (get_magic_quotes_gpc() == 1)
|
||||
{
|
||||
$query = stripslashes($query);
|
||||
}
|
||||
$query = 'attr_content:'.$query;
|
||||
|
||||
$solr = new Apache_Solr_Service('localhost', 8983, '/solr/');
|
||||
if ($solr->ping())
|
||||
{
|
||||
//try {
|
||||
$results = $solr->search($query, 0, 99999);
|
||||
if ($results) {
|
||||
foreach ($results->response->docs as $doc) {
|
||||
$ids[] = $doc->attr_candidato;
|
||||
}
|
||||
}
|
||||
/*}
|
||||
catch (Exception $e) {
|
||||
dbug($e->__toString());
|
||||
echo dbug('print');
|
||||
}*/
|
||||
}
|
||||
return $ids;
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
@ -1083,5 +1083,5 @@ $locale['5104'] = "Afinidad";
|
||||
$locale['5105'] = "Añadir nueva oferta";
|
||||
$locale['5106'] = "Referencia";
|
||||
$locale['5107'] = "Candidato";
|
||||
|
||||
$locale['5108'] = "Currículums";
|
||||
?>
|
||||
|
||||
367
src/vendor/SolrPhpClient/Apache/Solr/Document.php
vendored
Normal file
367
src/vendor/SolrPhpClient/Apache/Solr/Document.php
vendored
Normal file
@ -0,0 +1,367 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2007-2011, Servigistics, Inc.
|
||||
* 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.
|
||||
* - Neither the name of Servigistics, Inc. nor the names of
|
||||
* its contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* 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 COPYRIGHT OWNER 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.
|
||||
*
|
||||
* @copyright Copyright 2007-2011 Servigistics, Inc. (http://servigistics.com)
|
||||
* @license http://solr-php-client.googlecode.com/svn/trunk/COPYING New BSD
|
||||
* @version $Id: Document.php 54 2011-02-04 16:29:18Z donovan.jimenez $
|
||||
*
|
||||
* @package Apache
|
||||
* @subpackage Solr
|
||||
* @author Donovan Jimenez <djimenez@conduit-it.com>
|
||||
*/
|
||||
|
||||
/**
|
||||
* Holds Key / Value pairs that represent a Solr Document along with any associated boost
|
||||
* values. Field values can be accessed by direct dereferencing such as:
|
||||
* <code>
|
||||
* ...
|
||||
* $document->title = 'Something';
|
||||
* echo $document->title;
|
||||
* ...
|
||||
* </code>
|
||||
*
|
||||
* Additionally, the field values can be iterated with foreach
|
||||
*
|
||||
* <code>
|
||||
* foreach ($document as $fieldName => $fieldValue)
|
||||
* {
|
||||
* ...
|
||||
* }
|
||||
* </code>
|
||||
*/
|
||||
class Apache_Solr_Document implements IteratorAggregate
|
||||
{
|
||||
/**
|
||||
* SVN Revision meta data for this class
|
||||
*/
|
||||
const SVN_REVISION = '$Revision: 54 $';
|
||||
|
||||
/**
|
||||
* SVN ID meta data for this class
|
||||
*/
|
||||
const SVN_ID = '$Id: Document.php 54 2011-02-04 16:29:18Z donovan.jimenez $';
|
||||
|
||||
/**
|
||||
* Document boost value
|
||||
*
|
||||
* @var float
|
||||
*/
|
||||
protected $_documentBoost = false;
|
||||
|
||||
/**
|
||||
* Document field values, indexed by name
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_fields = array();
|
||||
|
||||
/**
|
||||
* Document field boost values, indexed by name
|
||||
*
|
||||
* @var array array of floats
|
||||
*/
|
||||
protected $_fieldBoosts = array();
|
||||
|
||||
/**
|
||||
* Clear all boosts and fields from this document
|
||||
*/
|
||||
public function clear()
|
||||
{
|
||||
$this->_documentBoost = false;
|
||||
|
||||
$this->_fields = array();
|
||||
$this->_fieldBoosts = array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get current document boost
|
||||
*
|
||||
* @return mixed will be false for default, or else a float
|
||||
*/
|
||||
public function getBoost()
|
||||
{
|
||||
return $this->_documentBoost;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set document boost factor
|
||||
*
|
||||
* @param mixed $boost Use false for default boost, else cast to float that should be > 0 or will be treated as false
|
||||
*/
|
||||
public function setBoost($boost)
|
||||
{
|
||||
$boost = (float) $boost;
|
||||
|
||||
if ($boost > 0.0)
|
||||
{
|
||||
$this->_documentBoost = $boost;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->_documentBoost = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a value to a multi-valued field
|
||||
*
|
||||
* NOTE: the solr XML format allows you to specify boosts
|
||||
* PER value even though the underlying Lucene implementation
|
||||
* only allows a boost per field. To remedy this, the final
|
||||
* field boost value will be the product of all specified boosts
|
||||
* on field values - this is similar to SolrJ's functionality.
|
||||
*
|
||||
* <code>
|
||||
* $doc = new Apache_Solr_Document();
|
||||
*
|
||||
* $doc->addField('foo', 'bar', 2.0);
|
||||
* $doc->addField('foo', 'baz', 3.0);
|
||||
*
|
||||
* // resultant field boost will be 6!
|
||||
* echo $doc->getFieldBoost('foo');
|
||||
* </code>
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
* @param mixed $boost Use false for default boost, else cast to float that should be > 0 or will be treated as false
|
||||
*/
|
||||
public function addField($key, $value, $boost = false)
|
||||
{
|
||||
if (!isset($this->_fields[$key]))
|
||||
{
|
||||
// create holding array if this is the first value
|
||||
$this->_fields[$key] = array();
|
||||
}
|
||||
else if (!is_array($this->_fields[$key]))
|
||||
{
|
||||
// move existing value into array if it is not already an array
|
||||
$this->_fields[$key] = array($this->_fields[$key]);
|
||||
}
|
||||
|
||||
if ($this->getFieldBoost($key) === false)
|
||||
{
|
||||
// boost not already set, set it now
|
||||
$this->setFieldBoost($key, $boost);
|
||||
}
|
||||
else if ((float) $boost > 0.0)
|
||||
{
|
||||
// multiply passed boost with current field boost - similar to SolrJ implementation
|
||||
$this->_fieldBoosts[$key] *= (float) $boost;
|
||||
}
|
||||
|
||||
// add value to array
|
||||
$this->_fields[$key][] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the array manipulation for a multi-valued field
|
||||
*
|
||||
* @param string $key
|
||||
* @param string $value
|
||||
* @param mixed $boost Use false for default boost, else cast to float that should be > 0 or will be treated as false
|
||||
*
|
||||
* @deprecated Use addField(...) instead
|
||||
*/
|
||||
public function setMultiValue($key, $value, $boost = false)
|
||||
{
|
||||
$this->addField($key, $value, $boost);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get field information
|
||||
*
|
||||
* @param string $key
|
||||
* @return mixed associative array of info if field exists, false otherwise
|
||||
*/
|
||||
public function getField($key)
|
||||
{
|
||||
if (isset($this->_fields[$key]))
|
||||
{
|
||||
return array(
|
||||
'name' => $key,
|
||||
'value' => $this->_fields[$key],
|
||||
'boost' => $this->getFieldBoost($key)
|
||||
);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a field value. Multi-valued fields should be set as arrays
|
||||
* or instead use the addField(...) function which will automatically
|
||||
* make sure the field is an array.
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
* @param mixed $boost Use false for default boost, else cast to float that should be > 0 or will be treated as false
|
||||
*/
|
||||
public function setField($key, $value, $boost = false)
|
||||
{
|
||||
$this->_fields[$key] = $value;
|
||||
$this->setFieldBoost($key, $boost);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the currently set field boost for a document field
|
||||
*
|
||||
* @param string $key
|
||||
* @return float currently set field boost, false if one is not set
|
||||
*/
|
||||
public function getFieldBoost($key)
|
||||
{
|
||||
return isset($this->_fieldBoosts[$key]) ? $this->_fieldBoosts[$key] : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the field boost for a document field
|
||||
*
|
||||
* @param string $key field name for the boost
|
||||
* @param mixed $boost Use false for default boost, else cast to float that should be > 0 or will be treated as false
|
||||
*/
|
||||
public function setFieldBoost($key, $boost)
|
||||
{
|
||||
$boost = (float) $boost;
|
||||
|
||||
if ($boost > 0.0)
|
||||
{
|
||||
$this->_fieldBoosts[$key] = $boost;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->_fieldBoosts[$key] = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return current field boosts, indexed by field name
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getFieldBoosts()
|
||||
{
|
||||
return $this->_fieldBoosts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the names of all fields in this document
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getFieldNames()
|
||||
{
|
||||
return array_keys($this->_fields);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the values of all fields in this document
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getFieldValues()
|
||||
{
|
||||
return array_values($this->_fields);
|
||||
}
|
||||
|
||||
/**
|
||||
* IteratorAggregate implementation function. Allows usage:
|
||||
*
|
||||
* <code>
|
||||
* foreach ($document as $key => $value)
|
||||
* {
|
||||
* ...
|
||||
* }
|
||||
* </code>
|
||||
*/
|
||||
public function getIterator()
|
||||
{
|
||||
$arrayObject = new ArrayObject($this->_fields);
|
||||
|
||||
return $arrayObject->getIterator();
|
||||
}
|
||||
|
||||
/**
|
||||
* Magic get for field values
|
||||
*
|
||||
* @param string $key
|
||||
* @return mixed
|
||||
*/
|
||||
public function __get($key)
|
||||
{
|
||||
if (isset($this->_fields[$key]))
|
||||
{
|
||||
return $this->_fields[$key];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Magic set for field values. Multi-valued fields should be set as arrays
|
||||
* or instead use the addField(...) function which will automatically
|
||||
* make sure the field is an array.
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
*/
|
||||
public function __set($key, $value)
|
||||
{
|
||||
$this->setField($key, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Magic isset for fields values. Do not call directly. Allows usage:
|
||||
*
|
||||
* <code>
|
||||
* isset($document->some_field);
|
||||
* </code>
|
||||
*
|
||||
* @param string $key
|
||||
* @return boolean
|
||||
*/
|
||||
public function __isset($key)
|
||||
{
|
||||
return isset($this->_fields[$key]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Magic unset for field values. Do not call directly. Allows usage:
|
||||
*
|
||||
* <code>
|
||||
* unset($document->some_field);
|
||||
* </code>
|
||||
*
|
||||
* @param string $key
|
||||
*/
|
||||
public function __unset($key)
|
||||
{
|
||||
unset($this->_fields[$key]);
|
||||
unset($this->_fieldBoosts[$key]);
|
||||
}
|
||||
}
|
||||
50
src/vendor/SolrPhpClient/Apache/Solr/Exception.php
vendored
Normal file
50
src/vendor/SolrPhpClient/Apache/Solr/Exception.php
vendored
Normal file
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2007-2011, Servigistics, Inc.
|
||||
* 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.
|
||||
* - Neither the name of Servigistics, Inc. nor the names of
|
||||
* its contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* 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 COPYRIGHT OWNER 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.
|
||||
*
|
||||
* @copyright Copyright 2007-2011 Servigistics, Inc. (http://servigistics.com)
|
||||
* @license http://solr-php-client.googlecode.com/svn/trunk/COPYING New BSD
|
||||
* @version $Id: Exception.php 54 2011-02-04 16:29:18Z donovan.jimenez $
|
||||
*
|
||||
* @package Apache
|
||||
* @subpackage Solr
|
||||
* @author Donovan Jimenez <djimenez@conduit-it.com>
|
||||
*/
|
||||
|
||||
class Apache_Solr_Exception extends Exception
|
||||
{
|
||||
/**
|
||||
* SVN Revision meta data for this class
|
||||
*/
|
||||
const SVN_REVISION = '$Revision: 54 $';
|
||||
|
||||
/**
|
||||
* SVN ID meta data for this class
|
||||
*/
|
||||
const SVN_ID = '$Id: Exception.php 54 2011-02-04 16:29:18Z donovan.jimenez $';
|
||||
}
|
||||
89
src/vendor/SolrPhpClient/Apache/Solr/HttpTransport/Abstract.php
vendored
Normal file
89
src/vendor/SolrPhpClient/Apache/Solr/HttpTransport/Abstract.php
vendored
Normal file
@ -0,0 +1,89 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2007-2011, Servigistics, Inc.
|
||||
* 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.
|
||||
* - Neither the name of Servigistics, Inc. nor the names of
|
||||
* its contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* 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 COPYRIGHT OWNER 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.
|
||||
*
|
||||
* @copyright Copyright 2007-2011 Servigistics, Inc. (http://servigistics.com)
|
||||
* @license http://solr-php-client.googlecode.com/svn/trunk/COPYING New BSD
|
||||
* @version $Id: $
|
||||
*
|
||||
* @package Apache
|
||||
* @subpackage Solr
|
||||
* @author Timo Schmidt <timo.schmidt@aoemedia.de>, Donovan Jimenez <djimenez@conduit-it.com>
|
||||
*/
|
||||
|
||||
/**
|
||||
* Convenience class that implements the transport implementation. Can be extended by
|
||||
* real implementations to do some of the common book keeping
|
||||
*/
|
||||
abstract class Apache_Solr_HttpTransport_Abstract implements Apache_Solr_HttpTransport_Interface
|
||||
{
|
||||
/**
|
||||
* Our default timeout value for requests that don't specify a timeout
|
||||
*
|
||||
* @var float
|
||||
*/
|
||||
private $_defaultTimeout = false;
|
||||
|
||||
/**
|
||||
* Get the current default timeout setting (initially the default_socket_timeout ini setting)
|
||||
* in seconds
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function getDefaultTimeout()
|
||||
{
|
||||
// lazy load the default timeout from the ini settings
|
||||
if ($this->_defaultTimeout === false)
|
||||
{
|
||||
$this->_defaultTimeout = (int) ini_get('default_socket_timeout');
|
||||
|
||||
// double check we didn't get 0 for a timeout
|
||||
if ($this->_defaultTimeout <= 0)
|
||||
{
|
||||
$this->_defaultTimeout = 60;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->_defaultTimeout;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the current default timeout for all HTTP requests
|
||||
*
|
||||
* @param float $timeout
|
||||
*/
|
||||
public function setDefaultTimeout($timeout)
|
||||
{
|
||||
$timeout = (float) $timeout;
|
||||
|
||||
if ($timeout >= 0)
|
||||
{
|
||||
$this->_defaultTimeout = $timeout;
|
||||
}
|
||||
}
|
||||
}
|
||||
198
src/vendor/SolrPhpClient/Apache/Solr/HttpTransport/Curl.php
vendored
Normal file
198
src/vendor/SolrPhpClient/Apache/Solr/HttpTransport/Curl.php
vendored
Normal file
@ -0,0 +1,198 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2007-2011, Servigistics, Inc.
|
||||
* 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.
|
||||
* - Neither the name of Servigistics, Inc. nor the names of
|
||||
* its contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* 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 COPYRIGHT OWNER 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.
|
||||
*
|
||||
* @copyright Copyright 2007-2011 Servigistics, Inc. (http://servigistics.com)
|
||||
* @license http://solr-php-client.googlecode.com/svn/trunk/COPYING New BSD
|
||||
* @version $Id: $
|
||||
*
|
||||
* @package Apache
|
||||
* @subpackage Solr
|
||||
* @author Timo Schmidt <timo.schmidt@aoemedia.de>, Donovan Jimenez <djimenez@conduit-it.com>
|
||||
*/
|
||||
|
||||
// Require Apache_Solr_HttpTransport_Abstract
|
||||
require_once(dirname(__FILE__) . '/Abstract.php');
|
||||
|
||||
/**
|
||||
* A Curl based HTTP transport. Uses a single curl session for all requests.
|
||||
*/
|
||||
class Apache_Solr_HttpTransport_Curl extends Apache_Solr_HttpTransport_Abstract
|
||||
{
|
||||
/**
|
||||
* SVN Revision meta data for this class
|
||||
*/
|
||||
const SVN_REVISION = '$Revision:$';
|
||||
|
||||
/**
|
||||
* SVN ID meta data for this class
|
||||
*/
|
||||
const SVN_ID = '$Id:$';
|
||||
|
||||
/**
|
||||
* Curl Session Handle
|
||||
*
|
||||
* @var resource
|
||||
*/
|
||||
private $_curl;
|
||||
|
||||
/**
|
||||
* Initializes a curl session
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
// initialize a CURL session
|
||||
$this->_curl = curl_init();
|
||||
|
||||
// set common options that will not be changed during the session
|
||||
curl_setopt_array($this->_curl, array(
|
||||
// return the response body from curl_exec
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
|
||||
// get the output as binary data
|
||||
CURLOPT_BINARYTRANSFER => true,
|
||||
|
||||
// we do not need the headers in the output, we get everything we need from curl_getinfo
|
||||
CURLOPT_HEADER => false
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes a curl session
|
||||
*/
|
||||
function __destruct()
|
||||
{
|
||||
// close our curl session
|
||||
curl_close($this->_curl);
|
||||
}
|
||||
|
||||
public function performGetRequest($url, $timeout = false)
|
||||
{
|
||||
// check the timeout value
|
||||
if ($timeout === false || $timeout <= 0.0)
|
||||
{
|
||||
// use the default timeout
|
||||
$timeout = $this->getDefaultTimeout();
|
||||
}
|
||||
|
||||
// set curl GET options
|
||||
curl_setopt_array($this->_curl, array(
|
||||
// make sure we're returning the body
|
||||
CURLOPT_NOBODY => false,
|
||||
|
||||
// make sure we're GET
|
||||
CURLOPT_HTTPGET => true,
|
||||
|
||||
// set the URL
|
||||
CURLOPT_URL => $url,
|
||||
|
||||
// set the timeout
|
||||
CURLOPT_TIMEOUT => $timeout
|
||||
));
|
||||
|
||||
// make the request
|
||||
$responseBody = curl_exec($this->_curl);
|
||||
|
||||
// get info from the transfer
|
||||
$statusCode = curl_getinfo($this->_curl, CURLINFO_HTTP_CODE);
|
||||
$contentType = curl_getinfo($this->_curl, CURLINFO_CONTENT_TYPE);
|
||||
|
||||
return new Apache_Solr_HttpTransport_Response($statusCode, $contentType, $responseBody);
|
||||
}
|
||||
|
||||
public function performHeadRequest($url, $timeout = false)
|
||||
{
|
||||
// check the timeout value
|
||||
if ($timeout === false || $timeout <= 0.0)
|
||||
{
|
||||
// use the default timeout
|
||||
$timeout = $this->getDefaultTimeout();
|
||||
}
|
||||
|
||||
// set curl HEAD options
|
||||
curl_setopt_array($this->_curl, array(
|
||||
// this both sets the method to HEAD and says not to return a body
|
||||
CURLOPT_NOBODY => true,
|
||||
|
||||
// set the URL
|
||||
CURLOPT_URL => $url,
|
||||
|
||||
// set the timeout
|
||||
CURLOPT_TIMEOUT => $timeout
|
||||
));
|
||||
|
||||
// make the request
|
||||
$responseBody = curl_exec($this->_curl);
|
||||
|
||||
// get info from the transfer
|
||||
$statusCode = curl_getinfo($this->_curl, CURLINFO_HTTP_CODE);
|
||||
$contentType = curl_getinfo($this->_curl, CURLINFO_CONTENT_TYPE);
|
||||
|
||||
return new Apache_Solr_HttpTransport_Response($statusCode, $contentType, $responseBody);
|
||||
}
|
||||
|
||||
public function performPostRequest($url, $postData, $contentType, $timeout = false)
|
||||
{
|
||||
// check the timeout value
|
||||
if ($timeout === false || $timeout <= 0.0)
|
||||
{
|
||||
// use the default timeout
|
||||
$timeout = $this->getDefaultTimeout();
|
||||
}
|
||||
|
||||
// set curl POST options
|
||||
curl_setopt_array($this->_curl, array(
|
||||
// make sure we're returning the body
|
||||
CURLOPT_NOBODY => false,
|
||||
|
||||
// make sure we're POST
|
||||
CURLOPT_POST => true,
|
||||
|
||||
// set the URL
|
||||
CURLOPT_URL => $url,
|
||||
|
||||
// set the post data
|
||||
CURLOPT_POSTFIELDS => $postData,
|
||||
|
||||
// set the content type
|
||||
CURLOPT_HTTPHEADER => array("Content-Type: {$contentType}"),
|
||||
|
||||
// set the timeout
|
||||
CURLOPT_TIMEOUT => $timeout
|
||||
));
|
||||
|
||||
// make the request
|
||||
$responseBody = curl_exec($this->_curl);
|
||||
|
||||
// get info from the transfer
|
||||
$statusCode = curl_getinfo($this->_curl, CURLINFO_HTTP_CODE);
|
||||
$contentType = curl_getinfo($this->_curl, CURLINFO_CONTENT_TYPE);
|
||||
|
||||
return new Apache_Solr_HttpTransport_Response($statusCode, $contentType, $responseBody);
|
||||
}
|
||||
}
|
||||
196
src/vendor/SolrPhpClient/Apache/Solr/HttpTransport/CurlNoReuse.php
vendored
Normal file
196
src/vendor/SolrPhpClient/Apache/Solr/HttpTransport/CurlNoReuse.php
vendored
Normal file
@ -0,0 +1,196 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2007-2011, Servigistics, Inc.
|
||||
* 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.
|
||||
* - Neither the name of Servigistics, Inc. nor the names of
|
||||
* its contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* 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 COPYRIGHT OWNER 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.
|
||||
*
|
||||
* @copyright Copyright 2007-2011 Servigistics, Inc. (http://servigistics.com)
|
||||
* @license http://solr-php-client.googlecode.com/svn/trunk/COPYING New BSD
|
||||
* @version $Id: $
|
||||
*
|
||||
* @package Apache
|
||||
* @subpackage Solr
|
||||
* @author Timo Schmidt <timo.schmidt@aoemedia.de>, Donovan Jimenez <djimenez@conduit-it.com>
|
||||
*/
|
||||
|
||||
// Require Apache_Solr_HttpTransport_Abstract
|
||||
require_once(dirname(__FILE__) . '/Abstract.php');
|
||||
|
||||
/**
|
||||
* An alternative Curl HTTP transport that opens and closes a curl session for
|
||||
* every request. This isn't the recommended way to use curl, but some version of
|
||||
* PHP have memory issues.
|
||||
*/
|
||||
class Apache_Solr_HttpTransport_CurlNoReuse extends Apache_Solr_HttpTransport_Abstract
|
||||
{
|
||||
/**
|
||||
* SVN Revision meta data for this class
|
||||
*/
|
||||
const SVN_REVISION = '$Revision:$';
|
||||
|
||||
/**
|
||||
* SVN ID meta data for this class
|
||||
*/
|
||||
const SVN_ID = '$Id:$';
|
||||
|
||||
public function performGetRequest($url, $timeout = false)
|
||||
{
|
||||
// check the timeout value
|
||||
if ($timeout === false || $timeout <= 0.0)
|
||||
{
|
||||
// use the default timeout
|
||||
$timeout = $this->getDefaultTimeout();
|
||||
}
|
||||
|
||||
$curl = curl_init();
|
||||
|
||||
// set curl GET options
|
||||
curl_setopt_array($curl, array(
|
||||
// return the response body from curl_exec
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
|
||||
// get the output as binary data
|
||||
CURLOPT_BINARYTRANSFER => true,
|
||||
|
||||
// we do not need the headers in the output, we get everything we need from curl_getinfo
|
||||
CURLOPT_HEADER => false,
|
||||
|
||||
// set the URL
|
||||
CURLOPT_URL => $url,
|
||||
|
||||
// set the timeout
|
||||
CURLOPT_TIMEOUT => $timeout
|
||||
));
|
||||
|
||||
// make the request
|
||||
$responseBody = curl_exec($curl);
|
||||
|
||||
// get info from the transfer
|
||||
$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
|
||||
$contentType = curl_getinfo($curl, CURLINFO_CONTENT_TYPE);
|
||||
|
||||
// close our curl session - we're done with it
|
||||
curl_close($curl);
|
||||
|
||||
return new Apache_Solr_HttpTransport_Response($statusCode, $contentType, $responseBody);
|
||||
}
|
||||
|
||||
public function performHeadRequest($url, $timeout = false)
|
||||
{
|
||||
// check the timeout value
|
||||
if ($timeout === false || $timeout <= 0.0)
|
||||
{
|
||||
// use the default timeout
|
||||
$timeout = $this->getDefaultTimeout();
|
||||
}
|
||||
|
||||
$curl = curl_init();
|
||||
|
||||
// set curl HEAD options
|
||||
curl_setopt_array($curl, array(
|
||||
// return the response body from curl_exec
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
|
||||
// get the output as binary data
|
||||
CURLOPT_BINARYTRANSFER => true,
|
||||
|
||||
// we do not need the headers in the output, we get everything we need from curl_getinfo
|
||||
CURLOPT_HEADER => false,
|
||||
|
||||
// this both sets the method to HEAD and says not to return a body
|
||||
CURLOPT_NOBODY => true,
|
||||
|
||||
// set the URL
|
||||
CURLOPT_URL => $url,
|
||||
|
||||
// set the timeout
|
||||
CURLOPT_TIMEOUT => $timeout
|
||||
));
|
||||
|
||||
// make the request
|
||||
$responseBody = curl_exec($curl);
|
||||
|
||||
// get info from the transfer
|
||||
$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
|
||||
$contentType = curl_getinfo($curl, CURLINFO_CONTENT_TYPE);
|
||||
|
||||
// close our curl session - we're done with it
|
||||
curl_close($curl);
|
||||
|
||||
return new Apache_Solr_HttpTransport_Response($statusCode, $contentType, $responseBody);
|
||||
}
|
||||
|
||||
public function performPostRequest($url, $postData, $contentType, $timeout = false)
|
||||
{
|
||||
// check the timeout value
|
||||
if ($timeout === false || $timeout <= 0.0)
|
||||
{
|
||||
// use the default timeout
|
||||
$timeout = $this->getDefaultTimeout();
|
||||
}
|
||||
|
||||
$curl = curl_init();
|
||||
|
||||
// set curl POST options
|
||||
curl_setopt_array($curl, array(
|
||||
// return the response body from curl_exec
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
|
||||
// get the output as binary data
|
||||
CURLOPT_BINARYTRANSFER => true,
|
||||
|
||||
// we do not need the headers in the output, we get everything we need from curl_getinfo
|
||||
CURLOPT_HEADER => false,
|
||||
|
||||
// make sure we're POST
|
||||
CURLOPT_POST => true,
|
||||
|
||||
// set the URL
|
||||
CURLOPT_URL => $url,
|
||||
|
||||
// set the post data
|
||||
CURLOPT_POSTFIELDS => $postData,
|
||||
|
||||
// set the content type
|
||||
CURLOPT_HTTPHEADER => array("Content-Type: {$contentType}"),
|
||||
|
||||
// set the timeout
|
||||
CURLOPT_TIMEOUT => $timeout
|
||||
));
|
||||
|
||||
// make the request
|
||||
$responseBody = curl_exec($curl);
|
||||
|
||||
// get info from the transfer
|
||||
$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
|
||||
$contentType = curl_getinfo($curl, CURLINFO_CONTENT_TYPE);
|
||||
|
||||
// close our curl session - we're done with it
|
||||
curl_close($curl);
|
||||
|
||||
return new Apache_Solr_HttpTransport_Response($statusCode, $contentType, $responseBody);
|
||||
}
|
||||
}
|
||||
216
src/vendor/SolrPhpClient/Apache/Solr/HttpTransport/FileGetContents.php
vendored
Normal file
216
src/vendor/SolrPhpClient/Apache/Solr/HttpTransport/FileGetContents.php
vendored
Normal file
@ -0,0 +1,216 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2007-2011, Servigistics, Inc.
|
||||
* 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.
|
||||
* - Neither the name of Servigistics, Inc. nor the names of
|
||||
* its contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* 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 COPYRIGHT OWNER 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.
|
||||
*
|
||||
* @copyright Copyright 2007-2011 Servigistics, Inc. (http://servigistics.com)
|
||||
* @license http://solr-php-client.googlecode.com/svn/trunk/COPYING New BSD
|
||||
* @version $Id: $
|
||||
*
|
||||
* @package Apache
|
||||
* @subpackage Solr
|
||||
* @author Donovan Jimenez <djimenez@conduit-it.com>
|
||||
*/
|
||||
|
||||
// Require Apache_Solr_HttpTransport_Abstract
|
||||
require_once(dirname(__FILE__) . '/Abstract.php');
|
||||
|
||||
/**
|
||||
* HTTP Transport implemenation that uses the builtin http URL wrappers and file_get_contents
|
||||
*/
|
||||
class Apache_Solr_HttpTransport_FileGetContents extends Apache_Solr_HttpTransport_Abstract
|
||||
{
|
||||
/**
|
||||
* SVN Revision meta data for this class
|
||||
*/
|
||||
const SVN_REVISION = '$Revision: $';
|
||||
|
||||
/**
|
||||
* SVN ID meta data for this class
|
||||
*/
|
||||
const SVN_ID = '$Id: $';
|
||||
|
||||
/**
|
||||
* Reusable stream context resources for GET and POST operations
|
||||
*
|
||||
* @var resource
|
||||
*/
|
||||
private $_getContext, $_headContext, $_postContext;
|
||||
|
||||
/**
|
||||
* Initializes our reuseable get and post stream contexts
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->_getContext = stream_context_create();
|
||||
$this->_headContext = stream_context_create();
|
||||
$this->_postContext = stream_context_create();
|
||||
}
|
||||
|
||||
public function performGetRequest($url, $timeout = false)
|
||||
{
|
||||
// set the timeout if specified
|
||||
if ($timeout !== FALSE && $timeout > 0.0)
|
||||
{
|
||||
// timeouts with file_get_contents seem to need
|
||||
// to be halved to work as expected
|
||||
$timeout = (float) $timeout / 2;
|
||||
|
||||
stream_context_set_option($this->_getContext, 'http', 'timeout', $timeout);
|
||||
}
|
||||
else
|
||||
{
|
||||
// use the default timeout pulled from default_socket_timeout otherwise
|
||||
stream_context_set_option($this->_getContext, 'http', 'timeout', $this->getDefaultTimeout());
|
||||
}
|
||||
|
||||
// $http_response_headers will be updated by the call to file_get_contents later
|
||||
// see http://us.php.net/manual/en/wrappers.http.php for documentation
|
||||
// Unfortunately, it will still create a notice in analyzers if we don't set it here
|
||||
$http_response_header = null;
|
||||
$responseBody = @file_get_contents($url, false, $this->_getContext);
|
||||
|
||||
return $this->_getResponseFromParts($responseBody, $http_response_header);
|
||||
}
|
||||
|
||||
public function performHeadRequest($url, $timeout = false)
|
||||
{
|
||||
stream_context_set_option($this->_headContext, array(
|
||||
'http' => array(
|
||||
// set HTTP method
|
||||
'method' => 'HEAD',
|
||||
|
||||
// default timeout
|
||||
'timeout' => $this->getDefaultTimeout()
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
// set the timeout if specified
|
||||
if ($timeout !== FALSE && $timeout > 0.0)
|
||||
{
|
||||
// timeouts with file_get_contents seem to need
|
||||
// to be halved to work as expected
|
||||
$timeout = (float) $timeout / 2;
|
||||
|
||||
stream_context_set_option($this->_headContext, 'http', 'timeout', $timeout);
|
||||
}
|
||||
|
||||
// $http_response_headers will be updated by the call to file_get_contents later
|
||||
// see http://us.php.net/manual/en/wrappers.http.php for documentation
|
||||
// Unfortunately, it will still create a notice in analyzers if we don't set it here
|
||||
$http_response_header = null;
|
||||
$responseBody = @file_get_contents($url, false, $this->_headContext);
|
||||
|
||||
return $this->_getResponseFromParts($responseBody, $http_response_header);
|
||||
}
|
||||
|
||||
public function performPostRequest($url, $rawPost, $contentType, $timeout = false)
|
||||
{
|
||||
stream_context_set_option($this->_postContext, array(
|
||||
'http' => array(
|
||||
// set HTTP method
|
||||
'method' => 'POST',
|
||||
|
||||
// Add our posted content type
|
||||
'header' => "Content-Type: $contentType",
|
||||
|
||||
// the posted content
|
||||
'content' => $rawPost,
|
||||
|
||||
// default timeout
|
||||
'timeout' => $this->getDefaultTimeout()
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
// set the timeout if specified
|
||||
if ($timeout !== FALSE && $timeout > 0.0)
|
||||
{
|
||||
// timeouts with file_get_contents seem to need
|
||||
// to be halved to work as expected
|
||||
$timeout = (float) $timeout / 2;
|
||||
|
||||
stream_context_set_option($this->_postContext, 'http', 'timeout', $timeout);
|
||||
}
|
||||
|
||||
// $http_response_header will be updated by the call to file_get_contents later
|
||||
// see http://us.php.net/manual/en/wrappers.http.php for documentation
|
||||
// Unfortunately, it will still create a notice in analyzers if we don't set it here
|
||||
$http_response_header = null;
|
||||
$responseBody = @file_get_contents($url, false, $this->_postContext);
|
||||
|
||||
// reset content of post context to reclaim memory
|
||||
stream_context_set_option($this->_postContext, 'http', 'content', '');
|
||||
|
||||
return $this->_getResponseFromParts($responseBody, $http_response_header);
|
||||
}
|
||||
|
||||
private function _getResponseFromParts($rawResponse, $httpHeaders)
|
||||
{
|
||||
//Assume 0, false as defaults
|
||||
$status = 0;
|
||||
$contentType = false;
|
||||
|
||||
//iterate through headers for real status, type, and encoding
|
||||
if (is_array($httpHeaders) && count($httpHeaders) > 0)
|
||||
{
|
||||
//look at the first headers for the HTTP status code
|
||||
//and message (errors are usually returned this way)
|
||||
//
|
||||
//HTTP 100 Continue response can also be returned before
|
||||
//the REAL status header, so we need look until we find
|
||||
//the last header starting with HTTP
|
||||
//
|
||||
//the spec: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.1
|
||||
//
|
||||
//Thanks to Daniel Andersson for pointing out this oversight
|
||||
while (isset($httpHeaders[0]) && substr($httpHeaders[0], 0, 4) == 'HTTP')
|
||||
{
|
||||
// we can do a intval on status line without the "HTTP/1.X " to get the code
|
||||
$status = intval(substr($httpHeaders[0], 9));
|
||||
|
||||
// remove this from the headers so we can check for more
|
||||
array_shift($httpHeaders);
|
||||
}
|
||||
|
||||
//Look for the Content-Type response header and determine type
|
||||
//and encoding from it (if possible - such as 'Content-Type: text/plain; charset=UTF-8')
|
||||
foreach ($httpHeaders as $header)
|
||||
{
|
||||
// look for the header that starts appropriately
|
||||
if (strncasecmp($header, 'Content-Type:', 13) == 0)
|
||||
{
|
||||
$contentType = substr($header, 13);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new Apache_Solr_HttpTransport_Response($status, $contentType, $rawResponse);
|
||||
}
|
||||
}
|
||||
94
src/vendor/SolrPhpClient/Apache/Solr/HttpTransport/Interface.php
vendored
Normal file
94
src/vendor/SolrPhpClient/Apache/Solr/HttpTransport/Interface.php
vendored
Normal file
@ -0,0 +1,94 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2007-2011, Servigistics, Inc.
|
||||
* 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.
|
||||
* - Neither the name of Servigistics, Inc. nor the names of
|
||||
* its contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* 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 COPYRIGHT OWNER 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.
|
||||
*
|
||||
* @copyright Copyright 2007-2011 Servigistics, Inc. (http://servigistics.com)
|
||||
* @license http://solr-php-client.googlecode.com/svn/trunk/COPYING New BSD
|
||||
* @version $Id: $
|
||||
*
|
||||
* @package Apache
|
||||
* @subpackage Solr
|
||||
* @author Timo Schmidt <timo.schmidt@aoemedia.de>, Donovan Jimenez <djimenez@conduit-it.com>
|
||||
*/
|
||||
|
||||
// require Apache_Solr_HttpTransport_Response
|
||||
require_once(dirname(__FILE__) . '/Response.php');
|
||||
|
||||
/**
|
||||
* Interface that all Transport (HTTP Requester) implementations must implement. These
|
||||
* Implementations can then be plugged into the Service instance in order to user their
|
||||
* the desired method for making HTTP requests
|
||||
*/
|
||||
interface Apache_Solr_HttpTransport_Interface
|
||||
{
|
||||
/**
|
||||
* Get the current default timeout for all HTTP requests
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function getDefaultTimeout();
|
||||
|
||||
/**
|
||||
* Set the current default timeout for all HTTP requests
|
||||
*
|
||||
* @param float $timeout
|
||||
*/
|
||||
public function setDefaultTimeout($timeout);
|
||||
|
||||
/**
|
||||
* Perform a GET HTTP operation with an optional timeout and return the response
|
||||
* contents, use getLastResponseHeaders to retrieve HTTP headers
|
||||
*
|
||||
* @param string $url
|
||||
* @param float $timeout
|
||||
* @return Apache_Solr_HttpTransport_Response HTTP response
|
||||
*/
|
||||
public function performGetRequest($url, $timeout = false);
|
||||
|
||||
/**
|
||||
* Perform a HEAD HTTP operation with an optional timeout and return the response
|
||||
* headers - NOTE: head requests have no response body
|
||||
*
|
||||
* @param string $url
|
||||
* @param float $timeout
|
||||
* @return Apache_Solr_HttpTransport_Response HTTP response
|
||||
*/
|
||||
public function performHeadRequest($url, $timeout = false);
|
||||
|
||||
/**
|
||||
* Perform a POST HTTP operation with an optional timeout and return the response
|
||||
* contents, use getLastResponseHeaders to retrieve HTTP headers
|
||||
*
|
||||
* @param string $url
|
||||
* @param string $rawPost
|
||||
* @param string $contentType
|
||||
* @param float $timeout
|
||||
* @return Apache_Solr_HttpTransport_Response HTTP response
|
||||
*/
|
||||
public function performPostRequest($url, $rawPost, $contentType, $timeout = false);
|
||||
}
|
||||
255
src/vendor/SolrPhpClient/Apache/Solr/HttpTransport/Response.php
vendored
Normal file
255
src/vendor/SolrPhpClient/Apache/Solr/HttpTransport/Response.php
vendored
Normal file
@ -0,0 +1,255 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2007-2011, Servigistics, Inc.
|
||||
* 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.
|
||||
* - Neither the name of Servigistics, Inc. nor the names of
|
||||
* its contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* 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 COPYRIGHT OWNER 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.
|
||||
*
|
||||
* @copyright Copyright 2007-2011 Servigistics, Inc. (http://servigistics.com)
|
||||
* @license http://solr-php-client.googlecode.com/svn/trunk/COPYING New BSD
|
||||
* @version $Id: $
|
||||
*
|
||||
* @package Apache
|
||||
* @subpackage Solr
|
||||
* @author Donovan Jimenez <djimenez@conduit-it.com>
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents the required pieces of an HTTP response provided by HTTP transport
|
||||
* implementations and then consumed by the Apache_Solr_Response class which provides
|
||||
* decoding
|
||||
*/
|
||||
class Apache_Solr_HttpTransport_Response
|
||||
{
|
||||
/**
|
||||
* Status Messages indexed by Status Code
|
||||
* Obtained from: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
static private $_defaultStatusMessages = array(
|
||||
// Specific to PHP Solr Client
|
||||
0 => "Communication Error",
|
||||
|
||||
// Informational 1XX
|
||||
100 => "Continue",
|
||||
101 => "Switching Protocols",
|
||||
|
||||
// Successful 2XX
|
||||
200 => "OK",
|
||||
201 => "Created",
|
||||
202 => "Accepted",
|
||||
203 => "Non-Authoritative Information",
|
||||
204 => "No Content",
|
||||
205 => "Reset Content",
|
||||
206 => "Partial Content",
|
||||
|
||||
// Redirection 3XX
|
||||
300 => "Multiple Choices",
|
||||
301 => "Moved Permanently",
|
||||
302 => "Found",
|
||||
303 => "See Other",
|
||||
304 => "Not Modified",
|
||||
305 => "Use Proxy",
|
||||
307 => "Temporary Redirect",
|
||||
|
||||
// Client Error 4XX
|
||||
400 => "Bad Request",
|
||||
401 => "Unauthorized",
|
||||
402 => "Payment Required",
|
||||
403 => "Forbidden",
|
||||
404 => "Not Found",
|
||||
405 => "Method Not Allowed",
|
||||
406 => "Not Acceptable",
|
||||
407 => "Proxy Authentication Required",
|
||||
408 => "Request Timeout",
|
||||
409 => "Conflict",
|
||||
410 => "Gone",
|
||||
411 => "Length Required",
|
||||
412 => "Precondition Failed",
|
||||
413 => "Request Entity Too Large",
|
||||
414 => "Request-URI Too Long",
|
||||
415 => "Unsupported Media Type",
|
||||
416 => "Request Range Not Satisfiable",
|
||||
417 => "Expectation Failed",
|
||||
|
||||
// Server Error 5XX
|
||||
500 => "Internal Server Error",
|
||||
501 => "Not Implemented",
|
||||
502 => "Bad Gateway",
|
||||
503 => "Service Unavailable",
|
||||
504 => "Gateway Timeout",
|
||||
505 => "HTTP Version Not Supported"
|
||||
);
|
||||
|
||||
/**
|
||||
* Get the HTTP status message based on status code
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getDefaultStatusMessage($statusCode)
|
||||
{
|
||||
$statusCode = (int) $statusCode;
|
||||
|
||||
if (isset(self::$_defaultStatusMessages[$statusCode]))
|
||||
{
|
||||
return self::$_defaultStatusMessages[$statusCode];
|
||||
}
|
||||
|
||||
return "Unknown Status";
|
||||
}
|
||||
|
||||
/**
|
||||
* The response's HTTP status code
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
private $_statusCode;
|
||||
|
||||
/**
|
||||
* The response's HTTP status message
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_statusMessage;
|
||||
|
||||
/**
|
||||
* The response's mime type
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_mimeType;
|
||||
|
||||
/**
|
||||
* The response's character encoding
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_encoding;
|
||||
|
||||
/**
|
||||
* The response's data
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_responseBody;
|
||||
|
||||
/**
|
||||
* Construct a HTTP transport response
|
||||
*
|
||||
* @param integer $statusCode The HTTP status code
|
||||
* @param string $contentType The VALUE of the Content-Type HTTP header
|
||||
* @param string $responseBody The body of the HTTP response
|
||||
*/
|
||||
public function __construct($statusCode, $contentType, $responseBody)
|
||||
{
|
||||
// set the status code, make sure its an integer
|
||||
$this->_statusCode = (int) $statusCode;
|
||||
|
||||
// lookup up status message based on code
|
||||
$this->_statusMessage = self::getDefaultStatusMessage($this->_statusCode);
|
||||
|
||||
// set the response body, it should always be a string
|
||||
$this->_responseBody = (string) $responseBody;
|
||||
|
||||
// parse the content type header value for mimetype and encoding
|
||||
// first set default values that will remain if we can't find
|
||||
// what we're looking for in the content type
|
||||
$this->_mimeType = "text/plain";
|
||||
$this->_encoding = "UTF-8";
|
||||
|
||||
if ($contentType)
|
||||
{
|
||||
// now break apart the header to see if there's character encoding
|
||||
$contentTypeParts = explode(';', $contentType, 2);
|
||||
|
||||
if (isset($contentTypeParts[0]))
|
||||
{
|
||||
$this->_mimeType = trim($contentTypeParts[0]);
|
||||
}
|
||||
|
||||
if (isset($contentTypeParts[1]))
|
||||
{
|
||||
// we have a second part, split it further
|
||||
$contentTypeParts = explode('=', $contentTypeParts[1]);
|
||||
|
||||
if (isset($contentTypeParts[1]))
|
||||
{
|
||||
$this->_encoding = trim($contentTypeParts[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the status code of the response
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getStatusCode()
|
||||
{
|
||||
return $this->_statusCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the status message of the response
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getStatusMessage()
|
||||
{
|
||||
return $this->_statusMessage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the mimetype of the response body
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getMimeType()
|
||||
{
|
||||
return $this->_mimeType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the charset encoding of the response body.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getEncoding()
|
||||
{
|
||||
return $this->_encoding;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the raw response body
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getBody()
|
||||
{
|
||||
return $this->_responseBody;
|
||||
}
|
||||
}
|
||||
79
src/vendor/SolrPhpClient/Apache/Solr/HttpTransportException.php
vendored
Normal file
79
src/vendor/SolrPhpClient/Apache/Solr/HttpTransportException.php
vendored
Normal file
@ -0,0 +1,79 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2007-2011, Servigistics, Inc.
|
||||
* 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.
|
||||
* - Neither the name of Servigistics, Inc. nor the names of
|
||||
* its contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* 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 COPYRIGHT OWNER 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.
|
||||
*
|
||||
* @copyright Copyright 2007-2011 Servigistics, Inc. (http://servigistics.com)
|
||||
* @license http://solr-php-client.googlecode.com/svn/trunk/COPYING New BSD
|
||||
* @version $Id: HttpTransportException.php 54 2011-02-04 16:29:18Z donovan.jimenez $
|
||||
*
|
||||
* @package Apache
|
||||
* @subpackage Solr
|
||||
* @author Donovan Jimenez <djimenez@conduit-it.com>
|
||||
*/
|
||||
|
||||
class Apache_Solr_HttpTransportException extends Apache_Solr_Exception
|
||||
{
|
||||
/**
|
||||
* SVN Revision meta data for this class
|
||||
*/
|
||||
const SVN_REVISION = '$Revision: 54 $';
|
||||
|
||||
/**
|
||||
* SVN ID meta data for this class
|
||||
*/
|
||||
const SVN_ID = '$Id: HttpTransportException.php 54 2011-02-04 16:29:18Z donovan.jimenez $';
|
||||
|
||||
/**
|
||||
* Response for which exception was generated
|
||||
*
|
||||
* @var Apache_Solr_Response
|
||||
*/
|
||||
private $_response;
|
||||
|
||||
/**
|
||||
* HttpTransportException Constructor
|
||||
*
|
||||
* @param Apache_Solr_Response $response
|
||||
*/
|
||||
public function __construct(Apache_Solr_Response $response)
|
||||
{
|
||||
parent::__construct("'{$response->getHttpStatus()}' Status: {$response->getHttpStatusMessage()}", $response->getHttpStatus());
|
||||
|
||||
$this->_response = $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the response for which this exception was generated
|
||||
*
|
||||
* @return Apache_Solr_Response
|
||||
*/
|
||||
public function getResponse()
|
||||
{
|
||||
return $this->_response;
|
||||
}
|
||||
}
|
||||
50
src/vendor/SolrPhpClient/Apache/Solr/InvalidArgumentException.php
vendored
Normal file
50
src/vendor/SolrPhpClient/Apache/Solr/InvalidArgumentException.php
vendored
Normal file
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2007-2011, Servigistics, Inc.
|
||||
* 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.
|
||||
* - Neither the name of Servigistics, Inc. nor the names of
|
||||
* its contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* 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 COPYRIGHT OWNER 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.
|
||||
*
|
||||
* @copyright Copyright 2007-2011 Servigistics, Inc. (http://servigistics.com)
|
||||
* @license http://solr-php-client.googlecode.com/svn/trunk/COPYING New BSD
|
||||
* @version $Id: InvalidArgumentException.php 54 2011-02-04 16:29:18Z donovan.jimenez $
|
||||
*
|
||||
* @package Apache
|
||||
* @subpackage Solr
|
||||
* @author Donovan Jimenez <djimenez@conduit-it.com>
|
||||
*/
|
||||
|
||||
class Apache_Solr_InvalidArgumentException extends Apache_Solr_Exception
|
||||
{
|
||||
/**
|
||||
* SVN Revision meta data for this class
|
||||
*/
|
||||
const SVN_REVISION = '$Revision: 54 $';
|
||||
|
||||
/**
|
||||
* SVN ID meta data for this class
|
||||
*/
|
||||
const SVN_ID = '$Id: InvalidArgumentException.php 54 2011-02-04 16:29:18Z donovan.jimenez $';
|
||||
}
|
||||
50
src/vendor/SolrPhpClient/Apache/Solr/NoServiceAvailableException.php
vendored
Normal file
50
src/vendor/SolrPhpClient/Apache/Solr/NoServiceAvailableException.php
vendored
Normal file
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2007-2011, Servigistics, Inc.
|
||||
* 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.
|
||||
* - Neither the name of Servigistics, Inc. nor the names of
|
||||
* its contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* 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 COPYRIGHT OWNER 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.
|
||||
*
|
||||
* @copyright Copyright 2007-2011 Servigistics, Inc. (http://servigistics.com)
|
||||
* @license http://solr-php-client.googlecode.com/svn/trunk/COPYING New BSD
|
||||
* @version $Id: NoServiceAvailableException.php 54 2011-02-04 16:29:18Z donovan.jimenez $
|
||||
*
|
||||
* @package Apache
|
||||
* @subpackage Solr
|
||||
* @author Donovan Jimenez <djimenez@conduit-it.com>
|
||||
*/
|
||||
|
||||
class Apache_Solr_NoServiceAvailableException extends Apache_Solr_Exception
|
||||
{
|
||||
/**
|
||||
* SVN Revision meta data for this class
|
||||
*/
|
||||
const SVN_REVISION = '$Revision: 54 $';
|
||||
|
||||
/**
|
||||
* SVN ID meta data for this class
|
||||
*/
|
||||
const SVN_ID = '$Id: NoServiceAvailableException.php 54 2011-02-04 16:29:18Z donovan.jimenez $';
|
||||
}
|
||||
50
src/vendor/SolrPhpClient/Apache/Solr/ParserException.php
vendored
Normal file
50
src/vendor/SolrPhpClient/Apache/Solr/ParserException.php
vendored
Normal file
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2007-2011, Servigistics, Inc.
|
||||
* 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.
|
||||
* - Neither the name of Servigistics, Inc. nor the names of
|
||||
* its contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* 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 COPYRIGHT OWNER 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.
|
||||
*
|
||||
* @copyright Copyright 2007-2011 Servigistics, Inc. (http://servigistics.com)
|
||||
* @license http://solr-php-client.googlecode.com/svn/trunk/COPYING New BSD
|
||||
* @version $Id: ParserException.php 54 2011-02-04 16:29:18Z donovan.jimenez $
|
||||
*
|
||||
* @package Apache
|
||||
* @subpackage Solr
|
||||
* @author Donovan Jimenez <djimenez@conduit-it.com>
|
||||
*/
|
||||
|
||||
class Apache_Solr_ParserException extends Apache_Solr_Exception
|
||||
{
|
||||
/**
|
||||
* SVN Revision meta data for this class
|
||||
*/
|
||||
const SVN_REVISION = '$Revision: 54 $';
|
||||
|
||||
/**
|
||||
* SVN ID meta data for this class
|
||||
*/
|
||||
const SVN_ID = '$Id: ParserException.php 54 2011-02-04 16:29:18Z donovan.jimenez $';
|
||||
}
|
||||
247
src/vendor/SolrPhpClient/Apache/Solr/Response.php
vendored
Normal file
247
src/vendor/SolrPhpClient/Apache/Solr/Response.php
vendored
Normal file
@ -0,0 +1,247 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2007-2011, Servigistics, Inc.
|
||||
* 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.
|
||||
* - Neither the name of Servigistics, Inc. nor the names of
|
||||
* its contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* 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 COPYRIGHT OWNER 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.
|
||||
*
|
||||
* @copyright Copyright 2007-2011 Servigistics, Inc. (http://servigistics.com)
|
||||
* @license http://solr-php-client.googlecode.com/svn/trunk/COPYING New BSD
|
||||
* @version $Id: Response.php 54 2011-02-04 16:29:18Z donovan.jimenez $
|
||||
*
|
||||
* @package Apache
|
||||
* @subpackage Solr
|
||||
* @author Donovan Jimenez <djimenez@conduit-it.com>
|
||||
*/
|
||||
|
||||
require_once(dirname(__FILE__) . '/ParserException.php');
|
||||
|
||||
/**
|
||||
* Represents a Solr response. Parses the raw response into a set of stdClass objects
|
||||
* and associative arrays for easy access.
|
||||
*
|
||||
* Currently requires json_decode which is bundled with PHP >= 5.2.0, Alternatively can be
|
||||
* installed with PECL. Zend Framework also includes a purely PHP solution.
|
||||
*/
|
||||
class Apache_Solr_Response
|
||||
{
|
||||
/**
|
||||
* SVN Revision meta data for this class
|
||||
*/
|
||||
const SVN_REVISION = '$Revision: 54 $';
|
||||
|
||||
/**
|
||||
* SVN ID meta data for this class
|
||||
*/
|
||||
const SVN_ID = '$Id: Response.php 54 2011-02-04 16:29:18Z donovan.jimenez $';
|
||||
|
||||
/**
|
||||
* Holds the raw response used in construction
|
||||
*
|
||||
* @var Apache_Solr_HttpTransport_Response HTTP response
|
||||
*/
|
||||
protected $_response;
|
||||
|
||||
/**
|
||||
* Whether the raw response has been parsed
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
protected $_isParsed = false;
|
||||
|
||||
/**
|
||||
* Parsed representation of the data
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $_parsedData;
|
||||
|
||||
/**
|
||||
* Data parsing flags. Determines what extra processing should be done
|
||||
* after the data is initially converted to a data structure.
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
protected $_createDocuments = true,
|
||||
$_collapseSingleValueArrays = true;
|
||||
|
||||
/**
|
||||
* Constructor. Takes the raw HTTP response body and the exploded HTTP headers
|
||||
*
|
||||
* @return Apache_Solr_HttpTransport_Response HTTP response
|
||||
* @param boolean $createDocuments Whether to convert the documents json_decoded as stdClass instances to Apache_Solr_Document instances
|
||||
* @param boolean $collapseSingleValueArrays Whether to make multivalued fields appear as single values
|
||||
*/
|
||||
public function __construct(Apache_Solr_HttpTransport_Response $response, $createDocuments = true, $collapseSingleValueArrays = true)
|
||||
{
|
||||
$this->_response = $response;
|
||||
$this->_createDocuments = (bool) $createDocuments;
|
||||
$this->_collapseSingleValueArrays = (bool) $collapseSingleValueArrays;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the HTTP status code
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getHttpStatus()
|
||||
{
|
||||
return $this->_response->getStatusCode();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the HTTP status message of the response
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getHttpStatusMessage()
|
||||
{
|
||||
return $this->_response->getStatusMessage();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get content type of this Solr response
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
return $this->_response->getMimeType();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get character encoding of this response. Should usually be utf-8, but just in case
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getEncoding()
|
||||
{
|
||||
return $this->_response->getEncoding();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the raw response as it was given to this object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getRawResponse()
|
||||
{
|
||||
return $this->_response->getBody();
|
||||
}
|
||||
|
||||
/**
|
||||
* Magic get to expose the parsed data and to lazily load it
|
||||
*
|
||||
* @param string $key
|
||||
* @return mixed
|
||||
*/
|
||||
public function __get($key)
|
||||
{
|
||||
if (!$this->_isParsed)
|
||||
{
|
||||
$this->_parseData();
|
||||
$this->_isParsed = true;
|
||||
}
|
||||
|
||||
if (isset($this->_parsedData->$key))
|
||||
{
|
||||
return $this->_parsedData->$key;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Magic function for isset function on parsed data
|
||||
*
|
||||
* @param string $key
|
||||
* @return boolean
|
||||
*/
|
||||
public function __isset($key)
|
||||
{
|
||||
if (!$this->_isParsed)
|
||||
{
|
||||
$this->_parseData();
|
||||
$this->_isParsed = true;
|
||||
}
|
||||
|
||||
return isset($this->_parsedData->$key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the raw response into the parsed_data array for access
|
||||
*
|
||||
* @throws Apache_Solr_ParserException If the data could not be parsed
|
||||
*/
|
||||
protected function _parseData()
|
||||
{
|
||||
//An alternative would be to use Zend_Json::decode(...)
|
||||
$data = json_decode($this->_response->getBody());
|
||||
|
||||
// check that we receive a valid JSON response - we should never receive a null
|
||||
if ($data === null)
|
||||
{
|
||||
throw new Apache_Solr_ParserException('Solr response does not appear to be valid JSON, please examine the raw response with getRawResponse() method');
|
||||
}
|
||||
|
||||
//if we're configured to collapse single valued arrays or to convert them to Apache_Solr_Document objects
|
||||
//and we have response documents, then try to collapse the values and / or convert them now
|
||||
if (($this->_createDocuments || $this->_collapseSingleValueArrays) && isset($data->response) && is_array($data->response->docs))
|
||||
{
|
||||
$documents = array();
|
||||
|
||||
foreach ($data->response->docs as $originalDocument)
|
||||
{
|
||||
if ($this->_createDocuments)
|
||||
{
|
||||
$document = new Apache_Solr_Document();
|
||||
}
|
||||
else
|
||||
{
|
||||
$document = $originalDocument;
|
||||
}
|
||||
|
||||
foreach ($originalDocument as $key => $value)
|
||||
{
|
||||
//If a result is an array with only a single
|
||||
//value then its nice to be able to access
|
||||
//it as if it were always a single value
|
||||
if ($this->_collapseSingleValueArrays && is_array($value) && count($value) <= 1)
|
||||
{
|
||||
$value = array_shift($value);
|
||||
}
|
||||
|
||||
$document->$key = $value;
|
||||
}
|
||||
|
||||
$documents[] = $document;
|
||||
}
|
||||
|
||||
$data->response->docs = $documents;
|
||||
}
|
||||
|
||||
$this->_parsedData = $data;
|
||||
}
|
||||
}
|
||||
1181
src/vendor/SolrPhpClient/Apache/Solr/Service.php
vendored
Normal file
1181
src/vendor/SolrPhpClient/Apache/Solr/Service.php
vendored
Normal file
File diff suppressed because it is too large
Load Diff
914
src/vendor/SolrPhpClient/Apache/Solr/Service/Balancer.php
vendored
Normal file
914
src/vendor/SolrPhpClient/Apache/Solr/Service/Balancer.php
vendored
Normal file
@ -0,0 +1,914 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2007-2011, Servigistics, Inc.
|
||||
* 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.
|
||||
* - Neither the name of Servigistics, Inc. nor the names of
|
||||
* its contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* 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 COPYRIGHT OWNER 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.
|
||||
*
|
||||
* @copyright Copyright 2007-2011 Servigistics, Inc. (http://servigistics.com)
|
||||
* @license http://solr-php-client.googlecode.com/svn/trunk/COPYING New BSD
|
||||
* @version $Id: Balancer.php 54 2011-02-04 16:29:18Z donovan.jimenez $
|
||||
*
|
||||
* @package Apache
|
||||
* @subpackage Solr
|
||||
* @author Donovan Jimenez <djimenez@conduit-it.com>, Dan Wolfe
|
||||
*/
|
||||
|
||||
// See Issue #1 (http://code.google.com/p/solr-php-client/issues/detail?id=1)
|
||||
// Doesn't follow typical include path conventions, but is more convenient for users
|
||||
require_once(dirname(dirname(__FILE__)) . '/Service.php');
|
||||
|
||||
require_once(dirname(dirname(__FILE__)) . '/NoServiceAvailableException.php');
|
||||
|
||||
/**
|
||||
* Reference Implementation for using multiple Solr services in a distribution. Functionality
|
||||
* includes:
|
||||
* routing of read / write operations
|
||||
* failover (on selection) for multiple read servers
|
||||
*/
|
||||
class Apache_Solr_Service_Balancer
|
||||
{
|
||||
/**
|
||||
* SVN Revision meta data for this class
|
||||
*/
|
||||
const SVN_REVISION = '$Revision: 54 $';
|
||||
|
||||
/**
|
||||
* SVN ID meta data for this class
|
||||
*/
|
||||
const SVN_ID = '$Id: Balancer.php 54 2011-02-04 16:29:18Z donovan.jimenez $';
|
||||
|
||||
protected $_createDocuments = true;
|
||||
|
||||
protected $_readableServices = array();
|
||||
protected $_writeableServices = array();
|
||||
|
||||
protected $_currentReadService = null;
|
||||
protected $_currentWriteService = null;
|
||||
|
||||
protected $_readPingTimeout = 2;
|
||||
protected $_writePingTimeout = 4;
|
||||
|
||||
// Configuration for server selection backoff intervals
|
||||
protected $_useBackoff = false; // Set to true to use more resillient write server selection
|
||||
protected $_backoffLimit = 600; // 10 minute default maximum
|
||||
protected $_backoffEscalation = 2.0; // Rate at which to increase backoff period
|
||||
protected $_defaultBackoff = 2.0; // Default backoff interval
|
||||
|
||||
/**
|
||||
* Escape a value for special query characters such as ':', '(', ')', '*', '?', etc.
|
||||
*
|
||||
* NOTE: inside a phrase fewer characters need escaped, use {@link Apache_Solr_Service::escapePhrase()} instead
|
||||
*
|
||||
* @param string $value
|
||||
* @return string
|
||||
*/
|
||||
static public function escape($value)
|
||||
{
|
||||
return Apache_Solr_Service::escape($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Escape a value meant to be contained in a phrase for special query characters
|
||||
*
|
||||
* @param string $value
|
||||
* @return string
|
||||
*/
|
||||
static public function escapePhrase($value)
|
||||
{
|
||||
return Apache_Solr_Service::escapePhrase($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience function for creating phrase syntax from a value
|
||||
*
|
||||
* @param string $value
|
||||
* @return string
|
||||
*/
|
||||
static public function phrase($value)
|
||||
{
|
||||
return Apache_Solr_Service::phrase($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor. Takes arrays of read and write service instances or descriptions
|
||||
*
|
||||
* @param array $readableServices
|
||||
* @param array $writeableServices
|
||||
*/
|
||||
public function __construct($readableServices = array(), $writeableServices = array())
|
||||
{
|
||||
//setup readable services
|
||||
foreach ($readableServices as $service)
|
||||
{
|
||||
$this->addReadService($service);
|
||||
}
|
||||
|
||||
//setup writeable services
|
||||
foreach ($writeableServices as $service)
|
||||
{
|
||||
$this->addWriteService($service);
|
||||
}
|
||||
}
|
||||
|
||||
public function setReadPingTimeout($timeout)
|
||||
{
|
||||
$this->_readPingTimeout = $timeout;
|
||||
}
|
||||
|
||||
public function setWritePingTimeout($timeout)
|
||||
{
|
||||
$this->_writePingTimeout = $timeout;
|
||||
}
|
||||
|
||||
public function setUseBackoff($enable)
|
||||
{
|
||||
$this->_useBackoff = $enable;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a service ID
|
||||
*
|
||||
* @param string $host
|
||||
* @param integer $port
|
||||
* @param string $path
|
||||
* @return string
|
||||
*/
|
||||
protected function _getServiceId($host, $port, $path)
|
||||
{
|
||||
return $host . ':' . $port . $path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a service instance or service descriptor (if it is already
|
||||
* not added)
|
||||
*
|
||||
* @param mixed $service
|
||||
*
|
||||
* @throws Apache_Solr_InvalidArgumentException If service descriptor is not valid
|
||||
*/
|
||||
public function addReadService($service)
|
||||
{
|
||||
if ($service instanceof Apache_Solr_Service)
|
||||
{
|
||||
$id = $this->_getServiceId($service->getHost(), $service->getPort(), $service->getPath());
|
||||
|
||||
$this->_readableServices[$id] = $service;
|
||||
}
|
||||
else if (is_array($service))
|
||||
{
|
||||
if (isset($service['host']) && isset($service['port']) && isset($service['path']))
|
||||
{
|
||||
$id = $this->_getServiceId((string)$service['host'], (int)$service['port'], (string)$service['path']);
|
||||
|
||||
$this->_readableServices[$id] = $service;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Apache_Solr_InvalidArgumentException('A Readable Service description array does not have all required elements of host, port, and path');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a service instance or descriptor from the available services
|
||||
*
|
||||
* @param mixed $service
|
||||
*
|
||||
* @throws Apache_Solr_InvalidArgumentException If service descriptor is not valid
|
||||
*/
|
||||
public function removeReadService($service)
|
||||
{
|
||||
$id = '';
|
||||
|
||||
if ($service instanceof Apache_Solr_Service)
|
||||
{
|
||||
$id = $this->_getServiceId($service->getHost(), $service->getPort(), $service->getPath());
|
||||
}
|
||||
else if (is_array($service))
|
||||
{
|
||||
if (isset($service['host']) && isset($service['port']) && isset($service['path']))
|
||||
{
|
||||
$id = $this->_getServiceId((string)$service['host'], (int)$service['port'], (string)$service['path']);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Apache_Solr_InvalidArgumentException('A Readable Service description array does not have all required elements of host, port, and path');
|
||||
}
|
||||
}
|
||||
else if (is_string($service))
|
||||
{
|
||||
$id = $service;
|
||||
}
|
||||
|
||||
if ($id && isset($this->_readableServices[$id]))
|
||||
{
|
||||
unset($this->_readableServices[$id]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a service instance or service descriptor (if it is already
|
||||
* not added)
|
||||
*
|
||||
* @param mixed $service
|
||||
*
|
||||
* @throws Apache_Solr_InvalidArgumentException If service descriptor is not valid
|
||||
*/
|
||||
public function addWriteService($service)
|
||||
{
|
||||
if ($service instanceof Apache_Solr_Service)
|
||||
{
|
||||
$id = $this->_getServiceId($service->getHost(), $service->getPort(), $service->getPath());
|
||||
|
||||
$this->_writeableServices[$id] = $service;
|
||||
}
|
||||
else if (is_array($service))
|
||||
{
|
||||
if (isset($service['host']) && isset($service['port']) && isset($service['path']))
|
||||
{
|
||||
$id = $this->_getServiceId((string)$service['host'], (int)$service['port'], (string)$service['path']);
|
||||
|
||||
$this->_writeableServices[$id] = $service;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Apache_Solr_InvalidArgumentException('A Writeable Service description array does not have all required elements of host, port, and path');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a service instance or descriptor from the available services
|
||||
*
|
||||
* @param mixed $service
|
||||
*
|
||||
* @throws Apache_Solr_InvalidArgumentException If service descriptor is not valid
|
||||
*/
|
||||
public function removeWriteService($service)
|
||||
{
|
||||
$id = '';
|
||||
|
||||
if ($service instanceof Apache_Solr_Service)
|
||||
{
|
||||
$id = $this->_getServiceId($service->getHost(), $service->getPort(), $service->getPath());
|
||||
}
|
||||
else if (is_array($service))
|
||||
{
|
||||
if (isset($service['host']) && isset($service['port']) && isset($service['path']))
|
||||
{
|
||||
$id = $this->_getServiceId((string)$service['host'], (int)$service['port'], (string)$service['path']);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Apache_Solr_InvalidArgumentException('A Readable Service description array does not have all required elements of host, port, and path');
|
||||
}
|
||||
}
|
||||
else if (is_string($service))
|
||||
{
|
||||
$id = $service;
|
||||
}
|
||||
|
||||
if ($id && isset($this->_writeableServices[$id]))
|
||||
{
|
||||
unset($this->_writeableServices[$id]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Iterate through available read services and select the first with a ping
|
||||
* that satisfies configured timeout restrictions (or the default)
|
||||
*
|
||||
* @return Apache_Solr_Service
|
||||
*
|
||||
* @throws Apache_Solr_NoServiceAvailableException If there are no read services that meet requirements
|
||||
*/
|
||||
protected function _selectReadService($forceSelect = false)
|
||||
{
|
||||
if (!$this->_currentReadService || !isset($this->_readableServices[$this->_currentReadService]) || $forceSelect)
|
||||
{
|
||||
if ($this->_currentReadService && isset($this->_readableServices[$this->_currentReadService]) && $forceSelect)
|
||||
{
|
||||
// we probably had a communication error, ping the current read service, remove it if it times out
|
||||
if ($this->_readableServices[$this->_currentReadService]->ping($this->_readPingTimeout) === false)
|
||||
{
|
||||
$this->removeReadService($this->_currentReadService);
|
||||
}
|
||||
}
|
||||
|
||||
if (count($this->_readableServices))
|
||||
{
|
||||
// select one of the read services at random
|
||||
$ids = array_keys($this->_readableServices);
|
||||
|
||||
$id = $ids[rand(0, count($ids) - 1)];
|
||||
$service = $this->_readableServices[$id];
|
||||
|
||||
if (is_array($service))
|
||||
{
|
||||
//convert the array definition to a client object
|
||||
$service = new Apache_Solr_Service($service['host'], $service['port'], $service['path']);
|
||||
$this->_readableServices[$id] = $service;
|
||||
}
|
||||
|
||||
$service->setCreateDocuments($this->_createDocuments);
|
||||
$this->_currentReadService = $id;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Apache_Solr_NoServiceAvailableException('No read services were available');
|
||||
}
|
||||
}
|
||||
|
||||
return $this->_readableServices[$this->_currentReadService];
|
||||
}
|
||||
|
||||
/**
|
||||
* Iterate through available write services and select the first with a ping
|
||||
* that satisfies configured timeout restrictions (or the default)
|
||||
*
|
||||
* @return Apache_Solr_Service
|
||||
*
|
||||
* @throws Apache_Solr_NoServiceAvailableException If there are no write services that meet requirements
|
||||
*/
|
||||
protected function _selectWriteService($forceSelect = false)
|
||||
{
|
||||
if($this->_useBackoff)
|
||||
{
|
||||
return $this->_selectWriteServiceSafe($forceSelect);
|
||||
}
|
||||
|
||||
if (!$this->_currentWriteService || !isset($this->_writeableServices[$this->_currentWriteService]) || $forceSelect)
|
||||
{
|
||||
if ($this->_currentWriteService && isset($this->_writeableServices[$this->_currentWriteService]) && $forceSelect)
|
||||
{
|
||||
// we probably had a communication error, ping the current read service, remove it if it times out
|
||||
if ($this->_writeableServices[$this->_currentWriteService]->ping($this->_writePingTimeout) === false)
|
||||
{
|
||||
$this->removeWriteService($this->_currentWriteService);
|
||||
}
|
||||
}
|
||||
|
||||
if (count($this->_writeableServices))
|
||||
{
|
||||
// select one of the read services at random
|
||||
$ids = array_keys($this->_writeableServices);
|
||||
|
||||
$id = $ids[rand(0, count($ids) - 1)];
|
||||
$service = $this->_writeableServices[$id];
|
||||
|
||||
if (is_array($service))
|
||||
{
|
||||
//convert the array definition to a client object
|
||||
$service = new Apache_Solr_Service($service['host'], $service['port'], $service['path']);
|
||||
$this->_writeableServices[$id] = $service;
|
||||
}
|
||||
|
||||
$this->_currentWriteService = $id;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Apache_Solr_NoServiceAvailableException('No write services were available');
|
||||
}
|
||||
}
|
||||
|
||||
return $this->_writeableServices[$this->_currentWriteService];
|
||||
}
|
||||
|
||||
/**
|
||||
* Iterate through available write services and select the first with a ping
|
||||
* that satisfies configured timeout restrictions (or the default). The
|
||||
* timeout period will increase until a connection is made or the limit is
|
||||
* reached. This will allow for increased reliability with heavily loaded
|
||||
* server(s).
|
||||
*
|
||||
* @return Apache_Solr_Service
|
||||
*
|
||||
* @throws Apache_Solr_NoServiceAvailableException If there are no write services that meet requirements
|
||||
*/
|
||||
|
||||
protected function _selectWriteServiceSafe($forceSelect = false)
|
||||
{
|
||||
if (!$this->_currentWriteService || !isset($this->_writeableServices[$this->_currentWriteService]) || $forceSelect)
|
||||
{
|
||||
if (count($this->_writeableServices))
|
||||
{
|
||||
$backoff = $this->_defaultBackoff;
|
||||
|
||||
do {
|
||||
// select one of the read services at random
|
||||
$ids = array_keys($this->_writeableServices);
|
||||
|
||||
$id = $ids[rand(0, count($ids) - 1)];
|
||||
$service = $this->_writeableServices[$id];
|
||||
|
||||
if (is_array($service))
|
||||
{
|
||||
//convert the array definition to a client object
|
||||
$service = new Apache_Solr_Service($service['host'], $service['port'], $service['path']);
|
||||
$this->_writeableServices[$id] = $service;
|
||||
}
|
||||
|
||||
$this->_currentWriteService = $id;
|
||||
|
||||
$backoff *= $this->_backoffEscalation;
|
||||
|
||||
if($backoff > $this->_backoffLimit)
|
||||
{
|
||||
throw new Apache_Solr_NoServiceAvailableException('No write services were available. All timeouts exceeded.');
|
||||
}
|
||||
|
||||
} while($this->_writeableServices[$this->_currentWriteService]->ping($backoff) === false);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Apache_Solr_NoServiceAvailableException('No write services were available');
|
||||
}
|
||||
}
|
||||
|
||||
return $this->_writeableServices[$this->_currentWriteService];
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the create documents flag. This determines whether {@link Apache_Solr_Response} objects will
|
||||
* parse the response and create {@link Apache_Solr_Document} instances in place.
|
||||
*
|
||||
* @param boolean $createDocuments
|
||||
*/
|
||||
public function setCreateDocuments($createDocuments)
|
||||
{
|
||||
$this->_createDocuments = (bool) $createDocuments;
|
||||
|
||||
// set on current read service
|
||||
if ($this->_currentReadService)
|
||||
{
|
||||
$service = $this->_selectReadService();
|
||||
$service->setCreateDocuments($createDocuments);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current state of teh create documents flag.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getCreateDocuments()
|
||||
{
|
||||
return $this->_createDocuments;
|
||||
}
|
||||
|
||||
/**
|
||||
* Raw Add Method. Takes a raw post body and sends it to the update service. Post body
|
||||
* should be a complete and well formed "add" xml document.
|
||||
*
|
||||
* @param string $rawPost
|
||||
* @return Apache_Solr_Response
|
||||
*
|
||||
* @throws Apache_Solr_HttpTransportException If an error occurs during the service call
|
||||
*/
|
||||
public function add($rawPost)
|
||||
{
|
||||
$service = $this->_selectWriteService();
|
||||
|
||||
do
|
||||
{
|
||||
try
|
||||
{
|
||||
return $service->add($rawPost);
|
||||
}
|
||||
catch (Apache_Solr_HttpTransportException $e)
|
||||
{
|
||||
if ($e->getCode() != 0) //IF NOT COMMUNICATION ERROR
|
||||
{
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
$service = $this->_selectWriteService(true);
|
||||
} while ($service);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a Solr Document to the index
|
||||
*
|
||||
* @param Apache_Solr_Document $document
|
||||
* @param boolean $allowDups
|
||||
* @param boolean $overwritePending
|
||||
* @param boolean $overwriteCommitted
|
||||
* @return Apache_Solr_Response
|
||||
*
|
||||
* @throws Apache_Solr_HttpTransportException If an error occurs during the service call
|
||||
*/
|
||||
public function addDocument(Apache_Solr_Document $document, $allowDups = false, $overwritePending = true, $overwriteCommitted = true)
|
||||
{
|
||||
$service = $this->_selectWriteService();
|
||||
|
||||
do
|
||||
{
|
||||
try
|
||||
{
|
||||
return $service->addDocument($document, $allowDups, $overwritePending, $overwriteCommitted);
|
||||
}
|
||||
catch (Apache_Solr_HttpTransportException $e)
|
||||
{
|
||||
if ($e->getCode() != 0) //IF NOT COMMUNICATION ERROR
|
||||
{
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
$service = $this->_selectWriteService(true);
|
||||
} while ($service);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an array of Solr Documents to the index all at once
|
||||
*
|
||||
* @param array $documents Should be an array of Apache_Solr_Document instances
|
||||
* @param boolean $allowDups
|
||||
* @param boolean $overwritePending
|
||||
* @param boolean $overwriteCommitted
|
||||
* @return Apache_Solr_Response
|
||||
*
|
||||
* @throws Apache_Solr_HttpTransportException If an error occurs during the service call
|
||||
*/
|
||||
public function addDocuments($documents, $allowDups = false, $overwritePending = true, $overwriteCommitted = true)
|
||||
{
|
||||
$service = $this->_selectWriteService();
|
||||
|
||||
do
|
||||
{
|
||||
try
|
||||
{
|
||||
return $service->addDocuments($documents, $allowDups, $overwritePending, $overwriteCommitted);
|
||||
}
|
||||
catch (Apache_Solr_HttpTransportException $e)
|
||||
{
|
||||
if ($e->getCode() != 0) //IF NOT COMMUNICATION ERROR
|
||||
{
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
$service = $this->_selectWriteService(true);
|
||||
} while ($service);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a commit command. Will be synchronous unless both wait parameters are set
|
||||
* to false.
|
||||
*
|
||||
* @param boolean $waitFlush
|
||||
* @param boolean $waitSearcher
|
||||
* @return Apache_Solr_Response
|
||||
*
|
||||
* @throws Apache_Solr_HttpTransportException If an error occurs during the service call
|
||||
*/
|
||||
public function commit($optimize = true, $waitFlush = true, $waitSearcher = true, $timeout = 3600)
|
||||
{
|
||||
$service = $this->_selectWriteService();
|
||||
|
||||
do
|
||||
{
|
||||
try
|
||||
{
|
||||
return $service->commit($optimize, $waitFlush, $waitSearcher, $timeout);
|
||||
}
|
||||
catch (Apache_Solr_HttpTransportException $e)
|
||||
{
|
||||
if ($e->getCode() != 0) //IF NOT COMMUNICATION ERROR
|
||||
{
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
$service = $this->_selectWriteService(true);
|
||||
} while ($service);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Raw Delete Method. Takes a raw post body and sends it to the update service. Body should be
|
||||
* a complete and well formed "delete" xml document
|
||||
*
|
||||
* @param string $rawPost
|
||||
* @param float $timeout Maximum expected duration of the delete operation on the server (otherwise, will throw a communication exception)
|
||||
* @return Apache_Solr_Response
|
||||
*
|
||||
* @throws Apache_Solr_HttpTransportException If an error occurs during the service call
|
||||
*/
|
||||
public function delete($rawPost, $timeout = 3600)
|
||||
{
|
||||
$service = $this->_selectWriteService();
|
||||
|
||||
do
|
||||
{
|
||||
try
|
||||
{
|
||||
return $service->delete($rawPost, $timeout);
|
||||
}
|
||||
catch (Apache_Solr_HttpTransportException $e)
|
||||
{
|
||||
if ($e->getCode() != 0) //IF NOT COMMUNICATION ERROR
|
||||
{
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
$service = $this->_selectWriteService(true);
|
||||
} while ($service);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a delete document based on document ID
|
||||
*
|
||||
* @param string $id
|
||||
* @param boolean $fromPending
|
||||
* @param boolean $fromCommitted
|
||||
* @param float $timeout Maximum expected duration of the delete operation on the server (otherwise, will throw a communication exception)
|
||||
* @return Apache_Solr_Response
|
||||
*
|
||||
* @throws Apache_Solr_HttpTransportException If an error occurs during the service call
|
||||
*/
|
||||
public function deleteById($id, $fromPending = true, $fromCommitted = true, $timeout = 3600)
|
||||
{
|
||||
$service = $this->_selectWriteService();
|
||||
|
||||
do
|
||||
{
|
||||
try
|
||||
{
|
||||
return $service->deleteById($id, $fromPending, $fromCommitted, $timeout);
|
||||
}
|
||||
catch (Apache_Solr_HttpTransportException $e)
|
||||
{
|
||||
if ($e->getCode() != 0) //IF NOT COMMUNICATION ERROR
|
||||
{
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
$service = $this->_selectWriteService(true);
|
||||
} while ($service);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create and post a delete document based on multiple document IDs.
|
||||
*
|
||||
* @param array $ids Expected to be utf-8 encoded strings
|
||||
* @param boolean $fromPending
|
||||
* @param boolean $fromCommitted
|
||||
* @param float $timeout Maximum expected duration of the delete operation on the server (otherwise, will throw a communication exception)
|
||||
* @return Apache_Solr_Response
|
||||
*
|
||||
* @throws Apache_Solr_HttpTransportException If an error occurs during the service call
|
||||
*/
|
||||
public function deleteByMultipleIds($ids, $fromPending = true, $fromCommitted = true, $timeout = 3600)
|
||||
{
|
||||
$service = $this->_selectWriteService();
|
||||
|
||||
do
|
||||
{
|
||||
try
|
||||
{
|
||||
return $service->deleteByMultipleId($ids, $fromPending, $fromCommitted, $timeout);
|
||||
}
|
||||
catch (Apache_Solr_HttpTransportException $e)
|
||||
{
|
||||
if ($e->getCode() != 0) //IF NOT COMMUNICATION ERROR
|
||||
{
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
$service = $this->_selectWriteService(true);
|
||||
} while ($service);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a delete document based on a query and submit it
|
||||
*
|
||||
* @param string $rawQuery
|
||||
* @param boolean $fromPending
|
||||
* @param boolean $fromCommitted
|
||||
* @param float $timeout Maximum expected duration of the delete operation on the server (otherwise, will throw a communication exception)
|
||||
* @return Apache_Solr_Response
|
||||
*
|
||||
* @throws Apache_Solr_HttpTransportException If an error occurs during the service call
|
||||
*/
|
||||
public function deleteByQuery($rawQuery, $fromPending = true, $fromCommitted = true, $timeout = 3600)
|
||||
{
|
||||
$service = $this->_selectWriteService();
|
||||
|
||||
do
|
||||
{
|
||||
try
|
||||
{
|
||||
return $service->deleteByQuery($rawQuery, $fromPending, $fromCommitted, $timeout);
|
||||
}
|
||||
catch (Apache_Solr_HttpTransportException $e)
|
||||
{
|
||||
if ($e->getCode() != 0) //IF NOT COMMUNICATION ERROR
|
||||
{
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
$service = $this->_selectWriteService(true);
|
||||
} while ($service);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use Solr Cell to extract document contents. See {@link http://wiki.apache.org/solr/ExtractingRequestHandler} for information on how
|
||||
* to use Solr Cell and what parameters are available.
|
||||
*
|
||||
* NOTE: when passing an Apache_Solr_Document instance, field names and boosts will automatically be prepended by "literal." and "boost."
|
||||
* as appropriate. Any keys from the $params array will NOT be treated this way. Any mappings from the document will overwrite key / value
|
||||
* pairs in the params array if they have the same name (e.g. you pass a "literal.id" key and value in your $params array but you also
|
||||
* pass in a document isntance with an "id" field" - the document's value(s) will take precedence).
|
||||
*
|
||||
* @param string $file Path to file to extract data from
|
||||
* @param array $params optional array of key value pairs that will be sent with the post (see Solr Cell documentation)
|
||||
* @param Apache_Solr_Document $document optional document that will be used to generate post parameters (literal.* and boost.* params)
|
||||
* @param string $mimetype optional mimetype specification (for the file being extracted)
|
||||
*
|
||||
* @return Apache_Solr_Response
|
||||
*
|
||||
* @throws Apache_Solr_InvalidArgumentException if $file, $params, or $document are invalid.
|
||||
*/
|
||||
public function extract($file, $params = array(), $document = null, $mimetype = 'application/octet-stream')
|
||||
{
|
||||
$service = $this->_selectWriteService();
|
||||
|
||||
do
|
||||
{
|
||||
try
|
||||
{
|
||||
return $service->extract($file, $params, $document, $mimetype);
|
||||
}
|
||||
catch (Apache_Solr_HttpTransportException $e)
|
||||
{
|
||||
if ($e->getCode() != 0) //IF NOT COMMUNICATION ERROR
|
||||
{
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
$service = $this->_selectWriteService(true);
|
||||
} while ($service);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use Solr Cell to extract document contents. See {@link http://wiki.apache.org/solr/ExtractingRequestHandler} for information on how
|
||||
* to use Solr Cell and what parameters are available.
|
||||
*
|
||||
* NOTE: when passing an Apache_Solr_Document instance, field names and boosts will automatically be prepended by "literal." and "boost."
|
||||
* as appropriate. Any keys from the $params array will NOT be treated this way. Any mappings from the document will overwrite key / value
|
||||
* pairs in the params array if they have the same name (e.g. you pass a "literal.id" key and value in your $params array but you also
|
||||
* pass in a document isntance with an "id" field" - the document's value(s) will take precedence).
|
||||
*
|
||||
* @param string $data Data that will be passed to Solr Cell
|
||||
* @param array $params optional array of key value pairs that will be sent with the post (see Solr Cell documentation)
|
||||
* @param Apache_Solr_Document $document optional document that will be used to generate post parameters (literal.* and boost.* params)
|
||||
* @param string $mimetype optional mimetype specification (for the file being extracted)
|
||||
*
|
||||
* @return Apache_Solr_Response
|
||||
*
|
||||
* @throws Apache_Solr_InvalidArgumentException if $file, $params, or $document are invalid.
|
||||
*
|
||||
* @todo Should be using multipart/form-data to post parameter values, but I could not get my implementation to work. Needs revisisted.
|
||||
*/
|
||||
public function extractFromString($data, $params = array(), $document = null, $mimetype = 'application/octet-stream')
|
||||
{
|
||||
$service = $this->_selectWriteService();
|
||||
|
||||
do
|
||||
{
|
||||
try
|
||||
{
|
||||
return $service->extractFromString($data, $params, $document, $mimetype);
|
||||
}
|
||||
catch (Apache_Solr_HttpTransportException $e)
|
||||
{
|
||||
if ($e->getCode() != 0) //IF NOT COMMUNICATION ERROR
|
||||
{
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
$service = $this->_selectWriteService(true);
|
||||
} while ($service);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send an optimize command. Will be synchronous unless both wait parameters are set
|
||||
* to false.
|
||||
*
|
||||
* @param boolean $waitFlush
|
||||
* @param boolean $waitSearcher
|
||||
* @param float $timeout Maximum expected duration of the optimize operation on the server (otherwise, will throw a communication exception)
|
||||
* @return Apache_Solr_Response
|
||||
*
|
||||
* @throws Apache_Solr_HttpTransportException If an error occurs during the service call
|
||||
*/
|
||||
public function optimize($waitFlush = true, $waitSearcher = true, $timeout = 3600)
|
||||
{
|
||||
$service = $this->_selectWriteService();
|
||||
|
||||
do
|
||||
{
|
||||
try
|
||||
{
|
||||
return $service->optimize($waitFlush, $waitSearcher, $timeout);
|
||||
}
|
||||
catch (Apache_Solr_HttpTransportException $e)
|
||||
{
|
||||
if ($e->getCode() != 0) //IF NOT COMMUNICATION ERROR
|
||||
{
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
$service = $this->_selectWriteService(true);
|
||||
} while ($service);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Simple Search interface
|
||||
*
|
||||
* @param string $query The raw query string
|
||||
* @param int $offset The starting offset for result documents
|
||||
* @param int $limit The maximum number of result documents to return
|
||||
* @param array $params key / value pairs for query parameters, use arrays for multivalued parameters
|
||||
* @param string $method The HTTP method (Apache_Solr_Service::METHOD_GET or Apache_Solr_Service::METHOD::POST)
|
||||
* @return Apache_Solr_Response
|
||||
*
|
||||
* @throws Apache_Solr_HttpTransportException If an error occurs during the service call
|
||||
*/
|
||||
public function search($query, $offset = 0, $limit = 10, $params = array(), $method = Apache_Solr_Service::METHOD_GET)
|
||||
{
|
||||
$service = $this->_selectReadService();
|
||||
|
||||
do
|
||||
{
|
||||
try
|
||||
{
|
||||
return $service->search($query, $offset, $limit, $params, $method);
|
||||
}
|
||||
catch (Apache_Solr_HttpTransportException $e)
|
||||
{
|
||||
if ($e->getCode() != 0) //IF NOT COMMUNICATION ERROR
|
||||
{
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
$service = $this->_selectReadService(true);
|
||||
} while ($service);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
26
src/vendor/SolrPhpClient/COPYING
vendored
Normal file
26
src/vendor/SolrPhpClient/COPYING
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
Copyright (c) 2007-2011, Servigistics, Inc.
|
||||
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.
|
||||
* Neither the name of Servigistics, Inc. nor the names of
|
||||
its contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
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 COPYRIGHT OWNER 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.
|
||||
342
src/vendor/SolrPhpClient/ChangeLog
vendored
Normal file
342
src/vendor/SolrPhpClient/ChangeLog
vendored
Normal file
@ -0,0 +1,342 @@
|
||||
2011-02-08 20:38 donovan.jimenez
|
||||
|
||||
* Apache/Solr/Service.php, tests/Apache/Solr/ServiceTest.php: See
|
||||
issue #59 - Adding service extractFromUrl method. This will use
|
||||
the configured HTTP transport to request the resource. extract
|
||||
has been modified to detect a file path that starts with http /
|
||||
https and to defer to extractFromUrl instead. Also, moved
|
||||
checking for params parameter to the top of method bodies so we
|
||||
can fail earlier rather than after we've gotten a file / url's
|
||||
content.
|
||||
|
||||
2011-02-08 19:28 donovan.jimenez
|
||||
|
||||
* Apache/Solr/Service.php, tests/Apache/Solr/ServiceTest.php: See
|
||||
issue #43 - Changing optimize parameter of service's commit
|
||||
method to its correct name: expungeDeletes. Also harded php unit
|
||||
tests around commit.
|
||||
|
||||
thanks to Liam O'Boyle and Olivier Ricordeau for patches for this
|
||||
commit and the previous one for issue #51
|
||||
|
||||
2011-02-08 19:11 donovan.jimenez
|
||||
|
||||
* Apache/Solr/Service.php, tests/Apache/Solr/ServiceTest.php: See
|
||||
issue #51 - adding commitWithin parameter to addDocument and
|
||||
addDocuments. Also hardened php unit tests for this functions
|
||||
|
||||
2011-02-04 16:29 donovan.jimenez
|
||||
|
||||
* Apache/Solr/Document.php, Apache/Solr/Exception.php,
|
||||
Apache/Solr/HttpTransport/Abstract.php,
|
||||
Apache/Solr/HttpTransport/Curl.php,
|
||||
Apache/Solr/HttpTransport/CurlNoReuse.php,
|
||||
Apache/Solr/HttpTransport/FileGetContents.php,
|
||||
Apache/Solr/HttpTransport/Interface.php,
|
||||
Apache/Solr/HttpTransport/Response.php,
|
||||
Apache/Solr/HttpTransportException.php,
|
||||
Apache/Solr/InvalidArgumentException.php,
|
||||
Apache/Solr/NoServiceAvailableException.php,
|
||||
Apache/Solr/ParserException.php, Apache/Solr/Response.php,
|
||||
Apache/Solr/Service.php, Apache/Solr/Service/Balancer.php,
|
||||
COPYING, tests/Apache/Solr/DocumentTest.php,
|
||||
tests/Apache/Solr/HttpTransport/AbstractTest.php,
|
||||
tests/Apache/Solr/HttpTransport/CurlNoReuseTest.php,
|
||||
tests/Apache/Solr/HttpTransport/CurlTest.php,
|
||||
tests/Apache/Solr/HttpTransport/FileGetContentsTest.php,
|
||||
tests/Apache/Solr/HttpTransport/ResponseTest.php,
|
||||
tests/Apache/Solr/HttpTransportExceptionTest.php,
|
||||
tests/Apache/Solr/ResponseTest.php,
|
||||
tests/Apache/Solr/Service/BalancerTest.php,
|
||||
tests/Apache/Solr/ServiceAbstractTest.php,
|
||||
tests/Apache/Solr/ServiceTest.php: Updating licence and copyright
|
||||
texts in sources to reflect transition from Conduit IT to
|
||||
Servigistics
|
||||
|
||||
2010-11-02 20:16 donovan.jimenez
|
||||
|
||||
* Apache/Solr/Service.php, Apache/Solr/Service/Balancer.php,
|
||||
tests/Apache/Solr/ServiceAbstractTest.php,
|
||||
tests/Apache/Solr/ServiceTest.php: See issue #55
|
||||
* Adding an Apache_Solr_Service::extractFromString method
|
||||
* Adding Apache_Solr_Service_Balancer::extract and
|
||||
Apache_Solr_Service_Balancer::extractFromString methods
|
||||
|
||||
2010-10-21 15:23 donovan.jimenez
|
||||
|
||||
* ., Apache/Solr/HttpTransport,
|
||||
Apache/Solr/HttpTransport/Abstract.php,
|
||||
Apache/Solr/HttpTransport/Curl.php,
|
||||
Apache/Solr/HttpTransport/CurlNoReuse.php,
|
||||
Apache/Solr/HttpTransport/FileGetContents.php,
|
||||
Apache/Solr/HttpTransport/Interface.php,
|
||||
Apache/Solr/HttpTransport/Response.php, Apache/Solr/Response.php,
|
||||
Apache/Solr/Service.php, Apache/Solr/Service/Balancer.php,
|
||||
COPYING, tests/Apache/Solr/DocumentTest.php,
|
||||
tests/Apache/Solr/HttpTransport,
|
||||
tests/Apache/Solr/HttpTransport/AbstractTest.php,
|
||||
tests/Apache/Solr/HttpTransport/CurlNoReuseTest.php,
|
||||
tests/Apache/Solr/HttpTransport/CurlTest.php,
|
||||
tests/Apache/Solr/HttpTransport/FileGetContentsTest.php,
|
||||
tests/Apache/Solr/HttpTransport/ResponseTest.php,
|
||||
tests/Apache/Solr/HttpTransportExceptionTest.php,
|
||||
tests/Apache/Solr/ResponseTest.php,
|
||||
tests/Apache/Solr/Service/BalancerTest.php,
|
||||
tests/Apache/Solr/Service/TestAll.php,
|
||||
tests/Apache/Solr/ServiceAbstractTest.php,
|
||||
tests/Apache/Solr/ServiceTest.php, tests/Apache/Solr/TestAll.php,
|
||||
tests/phpunit.bootstrap.inc, tests/phpunit.xml, tests/run.php:
|
||||
Merging the http_requests branch into trunk
|
||||
|
||||
See issue #49 - Service can now have the way it makes HTTP
|
||||
requests plugged in.
|
||||
The only requirement is that the plugin implement the new
|
||||
Apache_Solr_HttpTransport_Interface. There are initial
|
||||
implementations for using
|
||||
file_get_contents (what was used previously) and for using the
|
||||
curl module. Much
|
||||
thanks to Timo Schmidt for submitting an initial patch.
|
||||
|
||||
If the user does not specifically provide a transport interface
|
||||
instance, the
|
||||
file get contents implementation will be used by default.
|
||||
|
||||
There is a compatibility breaking change on the
|
||||
Apache_Solr_Response
|
||||
constructor. The Signature has changed.
|
||||
|
||||
The getDefaultTimeout and setDefaultTimeout methods on the
|
||||
Apache_Solr_Service
|
||||
class are now deprecated. They simple pass through to the active
|
||||
transport's
|
||||
methods of the same name, and I'd rather the user manage it
|
||||
there.
|
||||
|
||||
Additionally, I have cleaned up and expanded the existing unit
|
||||
tests - had to
|
||||
change tests related to the breaking change, and added new ones
|
||||
for the new
|
||||
classes as well as expanding existing ones. They should now all
|
||||
pass. curl tests
|
||||
should only run if the curl module is enabled. file get contents
|
||||
tests should
|
||||
only run if allow_url_fopen is enabled. transport tests do rely
|
||||
on an internet
|
||||
connection at this time.
|
||||
|
||||
2010-09-07 14:44 donovan.jimenez
|
||||
|
||||
* Apache/Solr/Document.php: See issue #48, doing an isset check as
|
||||
part of the magic get. Return null if not.
|
||||
|
||||
2010-09-07 14:34 donovan.jimenez
|
||||
|
||||
* Apache/Solr/Service.php: See issue #47, adding missing argument
|
||||
to getFieldBoost call in Apache_Solr_Service::extract method
|
||||
|
||||
2010-07-08 22:35 donovan.jimenez
|
||||
|
||||
* Apache/Solr/Service.php: See issue #37 - adding a getter /
|
||||
setting for the default timeout value. Still initially populated
|
||||
with the default_socket_timeout ini setting
|
||||
|
||||
2010-07-08 22:21 donovan.jimenez
|
||||
|
||||
* Apache/Solr/Service.php: See issue #42 - Adding missing require
|
||||
once for ParserException
|
||||
|
||||
2010-04-24 00:44 donovan.jimenez
|
||||
|
||||
* Apache/Solr/HttpTransportException.php, Apache/Solr/Service.php:
|
||||
See issue #38 - Adding support for Solr Cell (tika) extraction
|
||||
handler. Thanks to Liam O'Boyle for original patch.
|
||||
|
||||
2010-03-22 23:10 donovan.jimenez
|
||||
|
||||
* Apache/Solr/Service.php: See Issue #39 - send charset for POST
|
||||
form encoded data so that the servlet container for solr will
|
||||
interpret data correctly (will usually default to latin1)
|
||||
|
||||
2010-03-22 23:06 donovan.jimenez
|
||||
|
||||
* Apache/Solr/Service.php: Resolving Issue #40 - when using php
|
||||
with all error output or using a code analyzer, the
|
||||
http_response_header variable looks as though it won't be
|
||||
initialized before being used. Initializing it to null to
|
||||
alleviate the emitted warning.
|
||||
|
||||
2010-03-10 00:28 donovan.jimenez
|
||||
|
||||
* tests, tests/Apache, tests/Apache/Solr,
|
||||
tests/Apache/Solr/DocumentTest.php,
|
||||
tests/Apache/Solr/ResponseTest.php, tests/Apache/Solr/Service,
|
||||
tests/Apache/Solr/Service/BalancerTest.php,
|
||||
tests/Apache/Solr/Service/TestAll.php,
|
||||
tests/Apache/Solr/ServiceTest.php, tests/Apache/Solr/TestAll.php,
|
||||
tests/README, tests/phpunit.bootstrap.inc, tests/phpunit.xml,
|
||||
tests/run.php: Adding some very dusty unit tests. They are not
|
||||
complete, and some recent API changes may not be reflected in
|
||||
them, but they are a start.
|
||||
|
||||
2010-02-20 00:01 donovan.jimenez
|
||||
|
||||
* Apache/Solr/Service/Balancer.php: See Issue #34 - synchronizing
|
||||
Apache_Solr_Service_Balancer public methods with changes in
|
||||
Apache_Solr_Service. Specifically, adding some missing optional
|
||||
timeout parameters and adding the new deleteByMultipleIds method
|
||||
|
||||
2010-02-19 23:47 donovan.jimenez
|
||||
|
||||
* Apache/Solr/Response.php: See Issue #35 - implementing __isset
|
||||
magic method on Apache_Solr_Response
|
||||
|
||||
2010-02-19 23:36 donovan.jimenez
|
||||
|
||||
* Apache/Solr/Document.php, Apache/Solr/Exception.php,
|
||||
Apache/Solr/HttpTransportException.php,
|
||||
Apache/Solr/InvalidArgumentException.php,
|
||||
Apache/Solr/NoServiceAvailableException.php,
|
||||
Apache/Solr/ParserException.php, Apache/Solr/Response.php,
|
||||
Apache/Solr/Service.php, Apache/Solr/Service/Balancer.php: See
|
||||
Issue #36 - fix usage of generic exceptions, thanks to dennis
|
||||
vierkant for the patch.
|
||||
|
||||
2009-12-10 03:51 donovan.jimenez
|
||||
|
||||
* Apache/Solr/Service.php: Fixes issue #28 - Fixes typo in
|
||||
setNamedListTreatment function name. Thanks to alex dunae
|
||||
|
||||
2009-12-10 03:49 donovan.jimenez
|
||||
|
||||
* Apache/Solr/Response.php: Fixes issue #27 - when parsing the JSON
|
||||
data, add a check for null so we can throw an exception if the
|
||||
response seems to be invalid. Thanks to thomas rabaix for the
|
||||
suggestion.
|
||||
|
||||
2009-11-21 02:07 donovan.jimenez
|
||||
|
||||
* Apache/Solr/Service.php: see issue #23 - removing unused (by Sorl
|
||||
JSON writer) and incorrect (version did not track with Solr
|
||||
version) version parameter from all requests
|
||||
|
||||
2009-11-21 02:02 donovan.jimenez
|
||||
|
||||
* Apache/Solr/Service.php: Fixes #26 - Do a php version check
|
||||
against 5.1.3 to determine whether brackets will be url encoded
|
||||
by http_build_query function. Depending on the result of the
|
||||
version check use the proper regex for fixing up the query string
|
||||
before passing it to Solr
|
||||
|
||||
2009-11-09 22:46 donovan.jimenez
|
||||
|
||||
* Apache/Solr/Service.php: Fixes #20 - in previous fix, used
|
||||
stream_context_set_params when I should have used
|
||||
stream_context_set_option
|
||||
|
||||
2009-11-09 22:08 donovan.jimenez
|
||||
|
||||
* Apache/Solr/Service.php: Fixes #20 - Reusing a get and post
|
||||
context for each request instead of creating a new stream context
|
||||
for each. PHP does not provide a function to delete created
|
||||
stream contexts and does not appear to clean them up when they go
|
||||
out of scope, which leads to high memory usage when many solr
|
||||
requests were issued (typically in indexing usage)
|
||||
|
||||
2009-11-09 21:32 donovan.jimenez
|
||||
|
||||
* Apache/Solr/Service.php: Fixes #21 - Adding method to delete by
|
||||
multiple IDs. Thanks to pwolanin
|
||||
|
||||
2009-08-12 14:08 donovan.jimenez
|
||||
|
||||
* Apache/Solr/Response.php: The split function is deprecated as of
|
||||
PHP 5.3. Furthermore, since none of my split's were using a regex
|
||||
it is better to use explode anyway. Fixes #19
|
||||
|
||||
2009-08-04 18:23 donovan.jimenez
|
||||
|
||||
* Apache/Solr/Response.php, Apache/Solr/Service.php: Removed todo's
|
||||
about investigating Serialized PHP and PHP output writer usage.
|
||||
I've made the decision to stick to usage of JSON output writer
|
||||
until it can be proven that the other output writers are more
|
||||
stable or provide a substantially faster implementation. Closes
|
||||
issue #6
|
||||
|
||||
2009-08-04 17:53 donovan.jimenez
|
||||
|
||||
* Apache/Solr/Document.php, Apache/Solr/Response.php,
|
||||
Apache/Solr/Service.php, Apache/Solr/Service/Balancer.php: Adding
|
||||
useful SVN metadata constants to each Apache_Solr class by svn
|
||||
keyword substitution. Fixes issue #16
|
||||
|
||||
2009-08-04 17:14 donovan.jimenez
|
||||
|
||||
* Apache/Solr/Service.php: Fixes issue #5 - Applying patch (with
|
||||
minor changes) from mkalkbrenner to replace all control
|
||||
characters in Apache_Solr_Document keys / values with spaces to
|
||||
avoid an exception from Solr's XML Parser.
|
||||
|
||||
2009-07-20 14:14 donovan.jimenez
|
||||
|
||||
* Apache/Solr/Service.php: See issue #14
|
||||
* adding timeout parameters to all delete functions
|
||||
|
||||
2009-05-11 14:51 donovan.jimenez
|
||||
|
||||
* Apache/Solr/Service.php: See issue #8
|
||||
* Adding the ability to specify the HTTP method used for sending
|
||||
a search query (GET or POST)
|
||||
|
||||
2009-03-12 03:46 donovan.jimenez
|
||||
|
||||
* Apache/Solr/Service.php: See
|
||||
http://code.google.com/p/solr-php-client/issues/detail?id=4
|
||||
* Reworking Service::ping() to just use file_get_contents URL
|
||||
wrappers like we do for other GET's and POST operations
|
||||
* Reworked Service::_sendRawGet() and Service::_sendRawPost() to
|
||||
create a new stream context each time. Used for controlled
|
||||
request timeouts, headers, and POST information
|
||||
|
||||
2009-01-29 00:49 donovan.jimenez
|
||||
|
||||
* Apache/Solr/Document.php: See
|
||||
http://code.google.com/p/solr-php-client/issues/detail?id=2
|
||||
|
||||
Attempting to fix null vs. false boost parameter value issue by
|
||||
always casting to float value first.
|
||||
|
||||
Needs tested.
|
||||
|
||||
2009-01-28 17:11 donovan.jimenez
|
||||
|
||||
* Apache/Solr/Service.php, Apache/Solr/Service/Balancer.php: See
|
||||
http://code.google.com/p/solr-php-client/issues/detail?id=1
|
||||
|
||||
Changed require_once statements that expected the Solr Client
|
||||
library to be on the include path into statements that use the
|
||||
__FILE__ magic constant to do them as absolute paths. This should
|
||||
get rid of the requirement for the user to change their include
|
||||
path configuration or add the library to the include path at
|
||||
runtime.
|
||||
|
||||
Provided as a convenience for the user.
|
||||
|
||||
|
||||
2009-01-22 04:01 donovan.jimenez
|
||||
|
||||
* Apache/Solr/Document.php, Apache/Solr/Response.php,
|
||||
Apache/Solr/Service.php, Apache/Solr/Service/Balancer.php,
|
||||
COPYING: Updating license to New BSD for google code hosting.
|
||||
Also updating copyright message
|
||||
|
||||
2009-01-21 23:50 donovan.jimenez
|
||||
|
||||
* Apache, Apache/Solr, Apache/Solr/Document.php,
|
||||
Apache/Solr/Response.php, Apache/Solr/Service,
|
||||
Apache/Solr/Service.php, Apache/Solr/Service/Balancer.php:
|
||||
Importing Solr PHP client from last released zip file
|
||||
|
||||
2008-11-26 00:26
|
||||
|
||||
* .: Initial directory structure.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user