abstract class SolrUtils (View source)

(PECL solr >= 0.9.2)
Class SolrUtils
Contains utility methods for retrieving the current extension version and preparing query phrases.

Also contains method for escaping query strings and parsing XML responses.

Methods

static SolrObject
digestXmlResponse(string $xmlresponse, int $parse_mode = 0)

(PECL solr >= 0.9.2)
Parses an response XML string into a SolrObject

static string|false
escapeQueryChars(string $str)

(PECL solr >= 0.9.2)
Escapes a lucene query string

static string
getSolrVersion()

(PECL solr >= 0.9.2)
Returns the current version of the Solr extension

static string
queryPhrase(string $str)

(PECL solr >= 0.9.2)
Prepares a phrase from an unescaped lucene string

Details

static SolrObject digestXmlResponse(string $xmlresponse, int $parse_mode = 0)

(PECL solr >= 0.9.2)
Parses an response XML string into a SolrObject

Parameters

string $xmlresponse

The XML response string from the Solr server.

int $parse_mode

[optional]

Use SolrResponse::PARSE_SOLR_OBJ or SolrResponse::PARSE_SOLR_DOC

Return Value

SolrObject

Returns the SolrObject representing the XML response.

If the parse_mode parameter is set to SolrResponse::PARSE_SOLR_OBJ Solr documents will be parses as SolrObject instances.

If it is set to SolrResponse::PARSE_SOLR_DOC, they will be parsed as SolrDocument instances.

Exceptions

SolrException

static string|false escapeQueryChars(string $str)

(PECL solr >= 0.9.2)
Escapes a lucene query string

Parameters

string $str

This is the query string to be escaped.

Return Value

string|false

Returns the escaped string or FALSE on failure.

static string getSolrVersion()

(PECL solr >= 0.9.2)
Returns the current version of the Solr extension

Return Value

string

The current version of the Apache Solr extension.

static string queryPhrase(string $str)

(PECL solr >= 0.9.2)
Prepares a phrase from an unescaped lucene string

Parameters

string $str

The lucene phrase.

Return Value

string

Returns the phrase contained in double quotes.