Skip to content
Snippets Groups Projects
Commit c5d73c1e authored by Demian Katz's avatar Demian Katz
Browse files

Fixed bugs in Solr class (obsolete HTTP client syntax; namespace issue).

parent b1882ca0
No related merge requests found
...@@ -1028,7 +1028,7 @@ class Solr ...@@ -1028,7 +1028,7 @@ class Solr
public function getSaveXML($fields) public function getSaveXML($fields)
{ {
// Create XML Document // Create XML Document
$doc = new DOMDocument('1.0', 'UTF-8'); $doc = new \DOMDocument('1.0', 'UTF-8');
// Create add node // Create add node
$node = $doc->createElement('add'); $node = $doc->createElement('add');
...@@ -1314,9 +1314,8 @@ class Solr ...@@ -1314,9 +1314,8 @@ class Solr
if ($method == 'GET') { if ($method == 'GET') {
$uri .= '?' . $queryString; $uri .= '?' . $queryString;
} elseif ($method == 'POST') { } elseif ($method == 'POST') {
$this->client->setRawBody( $this->client->setEncType('application/x-www-form-urlencoded');
$queryString, 'application/x-www-form-urlencoded' $this->client->setRawBody($queryString);
);
} }
// Send Request // Send Request
...@@ -1340,7 +1339,7 @@ class Solr ...@@ -1340,7 +1339,7 @@ class Solr
protected function update($xml, $options = array()) protected function update($xml, $options = array())
{ {
$this->client->resetParameters(); $this->client->resetParameters();
$this->client->setConfig($options); $this->client->setOptions($options);
$this->client->setUri($this->host . "/update/"); $this->client->setUri($this->host . "/update/");
// debug // debug
...@@ -1352,7 +1351,8 @@ class Solr ...@@ -1352,7 +1351,8 @@ class Solr
} }
// Set up XML // Set up XML
$this->client->setRawBody($xml, 'text/xml; charset=utf-8'); $this->client->setEncType('text/xml; charset=utf-8');
$this->client->setRawBody($xml);
// Send Request // Send Request
$result = $this->client->setMethod('POST')->send(); $result = $this->client->setMethod('POST')->send();
...@@ -1642,9 +1642,8 @@ class Solr ...@@ -1642,9 +1642,8 @@ class Solr
if ($method == 'GET') { if ($method == 'GET') {
$uri .= '?' . $queryString; $uri .= '?' . $queryString;
} elseif ($method == 'POST') { } elseif ($method == 'POST') {
$this->client->setRawBody( $this->client->setEncType('application/x-www-form-urlencoded');
$queryString, 'application/x-www-form-urlencoded' $this->client->setRawBody($queryString);
);
} }
// Send Request // Send Request
...@@ -1675,13 +1674,14 @@ class Solr ...@@ -1675,13 +1674,14 @@ class Solr
{ {
$this->client->setUri($this->host . '/term'); $this->client->setUri($this->host . '/term');
$this->client->setParameterGet('terms', 'true'); $query = $this->client->getRequest()->getQuery();
$this->client->setParameterGet('terms.fl', $field); $query->set('terms', 'true');
$this->client->setParameterGet('terms.lower.incl', 'false'); $query->set('terms.fl', $field);
$this->client->setParameterGet('terms.lower', $start); $query->set('terms.lower.incl', 'false');
$this->client->setParameterGet('terms.limit', $limit); $query->set('terms.lower', $start);
$this->client->setParameterGet('terms.sort', 'index'); $query->set('terms.limit', $limit);
$this->client->setParameterGet('wt', 'json'); $query->set('terms.sort', 'index');
$query->set('wt', 'json');
$result = $this->client->setMethod('GET')->send(); $result = $this->client->setMethod('GET')->send();
$result = substr($result, strpos($result, '{')); $result = substr($result, strpos($result, '{'));
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment