Class midcom_services_indexer_XMLComm_RequestWriter

Description

This class provides an interface to the MRFC 14 XML driven indexer backends.

This class is responsible for producing an XML Request file.

...

Located in /midcom/services/indexer/XMLCommClient.php (line 24)


	
			
Variable Summary
 string $_index_name
 mixed $_request
Method Summary
 midcom_services_indexer_XMLComm_RequestWriter midcom_services_indexer_XMLComm_RequestWriter ([string $index_name = null])
 void add_delete (string $id, string $RI)
 void add_deleteall (string $id)
 void add_index (string $id, mixed $documents, mixed $document)
 void add_query (string $id, string $query, [midcom_services_indexer_filter $filter = null])
 string get_xml ([bool $mask_request = false])
 void _clean_content_control_chars (string $string)
 string _encode_argument (string $string)
 string _encode_cdata (string $string)
Variables
string $_index_name = null (line 32)

The index name to use

  • access: private
mixed $_request = '' (line 39)

The current request content. This does not include the XML header and the enclosing request tag. This will be added upon retrieval of this string.

Methods
Constructor midcom_services_indexer_XMLComm_RequestWriter (line 48)

Initialize an XMLComm Request Writer.

All double-quotes will be silently removed from the index name.

midcom_services_indexer_XMLComm_RequestWriter midcom_services_indexer_XMLComm_RequestWriter ([string $index_name = null])
  • string $index_name: The name of the Index to be used. If not specified, the midcom config key 'indexer_index_name' is used.
add_delete (line 177)

Adds a delete request.

void add_delete (string $id, string $RI)
  • string $id: The ID of the request.
  • string $RI: The document's resource identifier.
add_deleteall (line 189)

Adds a drop index request.

void add_deleteall (string $id)
  • string $id: The ID of the request.
add_index (line 137)

Index one or more documents.

void add_index (string $id, mixed $documents, mixed $document)
  • string $id: The ID of the request.
  • mixed $document: One or more documents to be indexed, so this is either a midcom_services_indexer_document or an Array of these objects.
add_query (line 91)

Add a query to the request.

void add_query (string $id, string $query, [midcom_services_indexer_filter $filter = null])
  • string $id: The ID of the request.
  • string $query: The query string (added as CDATA).
  • midcom_services_indexer_filter $filter: An optional filter for the resultset.
get_xml (line 71)

Surrounds the request data with an xml header and the request tags and returns the result.

  • return: XML request including all headers and the DOCTYPE declaration.
string get_xml ([bool $mask_request = false])
  • bool $mask_request: Set this to true to mask all occurences of </request> in the content with </request_>, which is required for the TCP backends. (PHP cannot close a TCP socket in one direction only, so EOF checks won't work.
_clean_content_control_chars (line 229)

Removes all control characters except LF from the content, as this might throw the indexer off-track (valid XML and the like).

WARNING: This function could break UTF-8 sequences right now, I'm on the lookout for a better regex, as I do not know if the /u pattern modifier is enough. I just hope so.

  • todo: Finish Regex.
void _clean_content_control_chars (string $string)
  • string $string: The string to process.
_encode_argument (line 204)

Encodes an argument masking both single and double quotes.

  • return: The modified string.
string _encode_argument (string $string)
  • string $string: String to modify.
_encode_cdata (line 215)

Encodes a string using CDATA encoding.

  • return: The encoded string including the CDATA tags.
string _encode_cdata (string $string)
  • string $string: The original string.

Documentation generated on Mon, 21 Nov 2005 18:25:01 +0100 by phpDocumentor 1.3.0RC3