Query the Solr server. More...

Public Member Functions

 __construct ($core="", $host="localhost", $port="8983", $fieldIndexFolder="/tmp/")
 Constructor.
 __destruct ()
 select ($query)
 Send a select query to the Solr server.
 update ($content)
 Send a update query to the Solr server.
 commit ()
 Send a commit query to the Solr server.
 deleteInstanceRecord ($uri, $dataset)
 Delete a specific instance record in the solr index.
 optimize ()
 Send a optimize query to the Solr server.
 flushIndex ()
 Remove all records in the Solr index.
 flushDataset ($dataset)
 Remove all records in the Solr index, belonging to a specific dataset.
 createSolrAddElementFromWSElement ($wsElement)
 Create a Solr element to add to the index from a web service XML element (the XML representation of a RDF resource of the web services).
 xmlEncode ($string)
 Create/Update a Solr document.
 getFieldsIndex ()
 Get the array of the name of all the fields that have been indexed in Solr.
 updateFieldsIndex ()
 Force an update of the fields index using the Luke solr endpoint.

Private Member Functions

 sendQuery ($query)
 Send any kind of query to the Solr server.
 sendContent ($content)
 Send any kind of query to the Solr server.

Private Attributes

 $updateUrl
 URL where to reach the Solr update endpoint.
 $selectUrl
 URL where to reach the Solr select (normal query) endpoint.
 $lukeUrl
 URL where to reach the Solr Luke endpoint.
 $fieldIndexFolder
 This is the folder there the file of the index where all the fields defined in Solr are indexed. You have to make sure that the web server has write access to this folder. This folder path has to end with a slash "/".

Detailed Description

Query the Solr server.

Author:
Frederick Giasson, Structured Dynamics LLC.

Definition at line 21 of file Solr.php.


Constructor & Destructor Documentation

__construct ( core = "",
host = "localhost",
port = "8983",
fieldIndexFolder = "/tmp/" 
)

Constructor.


Parameters:
[in] $core An optional target Solr core in a multicore setting
[in] $host The host name where the Solr server is accessible
[in] $port The port number where the Solr server is accessible
[in] $fieldIndexFolder The folder where the Solr fields index should be saved on the server
Returns:
returns the XML resultset
Author:
Frederick Giasson, Structured Dynamics LLC.




Definition at line 54 of file Solr.php.

References $fieldIndexFolder.

__destruct (  ) 

Definition at line 72 of file Solr.php.


Member Function Documentation

commit (  ) 

Send a commit query to the Solr server.


Returns:
returns the XML resultset with the status of this request
Author:
Frederick Giasson, Structured Dynamics LLC.




Definition at line 112 of file Solr.php.

References sendContent().

Here is the call graph for this function:

createSolrAddElementFromWSElement ( wsElement  ) 

Create a Solr element to add to the index from a web service XML element (the XML representation of a RDF resource of the web services).


Parameters:
[in] $wsElement Web service element to convert
Returns:
returns an array of Solr document to index
Todo:
"object_property" and "object_label" have to be added once everything is indexed.
Author:
Frederick Giasson, Structured Dynamics LLC.




Definition at line 223 of file Solr.php.

References $type, $types, and xmlEncode().

Here is the call graph for this function:

deleteInstanceRecord ( uri,
dataset 
)

Delete a specific instance record in the solr index.


Parameters:
[in] $uri URI of the instance record to delete
[in] $dataset Dataset URI where the instance record is described
Author:
Frederick Giasson, Structured Dynamics LLC.




Definition at line 126 of file Solr.php.

References $dataset, $uri, and sendContent().

Here is the call graph for this function:

flushDataset ( dataset  ) 

Remove all records in the Solr index, belonging to a specific dataset.


Parameters:
[in] $dataset Dataset to remove
Returns:
returns the XML resultset with the status of this request
Author:
Frederick Giasson, Structured Dynamics LLC.




Definition at line 170 of file Solr.php.

References sendContent().

Here is the call graph for this function:

flushIndex (  ) 

Remove all records in the Solr index.


Returns:
returns the XML resultset with the status of this request
Author:
Frederick Giasson, Structured Dynamics LLC.




Definition at line 156 of file Solr.php.

References sendContent().

Here is the call graph for this function:

getFieldsIndex (  ) 

Get the array of the name of all the fields that have been indexed in Solr.

Returns:
Return an array of all the names of the fields defined in the Solr index.
Author:
Frederick Giasson, Structured Dynamics LLC.

Definition at line 467 of file Solr.php.

References updateFieldsIndex().

Here is the call graph for this function:

optimize (  ) 

Send a optimize query to the Solr server.


Returns:
returns the XML resultset with the status of this request
Author:
Frederick Giasson, Structured Dynamics LLC.




Definition at line 144 of file Solr.php.

References sendContent().

Here is the call graph for this function:

select ( query  ) 

Send a select query to the Solr server.


Parameters:
[in] $query Solr query
Returns:
returns the XML resultset
Author:
Frederick Giasson, Structured Dynamics LLC.




Definition at line 86 of file Solr.php.

References $query, and sendQuery().

Here is the call graph for this function:

sendContent ( content  )  [private]

Send any kind of query to the Solr server.


Parameters:
[in] $content Solr query to send to the server
Returns:
returns the XML resultset with the status of this request
Author:
Frederick Giasson, Structured Dynamics LLC.




Definition at line 427 of file Solr.php.

Referenced by commit(), deleteInstanceRecord(), flushDataset(), flushIndex(), optimize(), and update().

sendQuery ( query  )  [private]

Send any kind of query to the Solr server.


Parameters:
[in] $query Solr query to send to the server
Returns:
returns the XML resultset with the status of this request
Author:
Frederick Giasson, Structured Dynamics LLC.




Definition at line 184 of file Solr.php.

References $query.

Referenced by select().

update ( content  ) 

Send a update query to the Solr server.


Parameters:
[in] $content Solr content (add) XML item to add to the server
Returns:
returns the XML resultset with the status of this request
Author:
Frederick Giasson, Structured Dynamics LLC.




Definition at line 100 of file Solr.php.

References sendContent().

Here is the call graph for this function:

updateFieldsIndex (  ) 

Force an update of the fields index using the Luke solr endpoint.

Returns:
Return FALSE if the index couldn't be update. TRUE otherwise.
Author:
Frederick Giasson, Structured Dynamics LLC.

Definition at line 484 of file Solr.php.

Referenced by getFieldsIndex().

xmlEncode ( string  ) 

Create/Update a Solr document.


Parameters:
[in] $solrDocument A SolrDocument description
Returns:
returns FALSE for an internal error
Author:
Frederick Giasson, Structured Dynamics LLC.




Encode content to be included in XML files

Parameters:
[in] $string The content string to be encoded
Returns:
returns the encoded string
Author:
Frederick Giasson, Structured Dynamics LLC.




Definition at line 412 of file Solr.php.

Referenced by createSolrAddElementFromWSElement().


Field Documentation

$fieldIndexFolder [private]

This is the folder there the file of the index where all the fields defined in Solr are indexed. You have to make sure that the web server has write access to this folder. This folder path has to end with a slash "/".

Definition at line 36 of file Solr.php.

Referenced by __construct().

$lukeUrl [private]

URL where to reach the Solr Luke endpoint.

Definition at line 30 of file Solr.php.

$selectUrl [private]

URL where to reach the Solr select (normal query) endpoint.

Definition at line 27 of file Solr.php.

$updateUrl [private]

URL where to reach the Solr update endpoint.

Definition at line 24 of file Solr.php.


The documentation for this class was generated from the following file:
Copyright © 2009-2011. Structured Dynamics LLC Structured Dynamics LLC. All rights reserved.