Class midcom_services_indexer

Description

This class is the main access point into the MidCOM Indexer subsystem.

It allows you to maintain and query the MidCOM document index.

Do not instantinate this class directly. Instead use the get_service method on midcom_application using the service name 'indexer' to obtain a running instance. You must honor the reference of that call.

Located in /midcom/services/indexer.php (line 45)


	
			
Variable Summary
Method Summary
 midcom_services_indexer midcom_services_indexer ([midcom_services_indexer_backend $backend = null])
 bool delete (string $RI)
 bool delete_all ()
 bool index (mixed $documents)
 Array query (string $query, [midcom_services_indexer_filter $filter = null])
 void _check_permissions_topic (mixed $document)
Variables
midcom_services_indexer_backend $_backend = null (line 53)

The backend indexer implementation

  • access: private
bool $_disabled = false (line 61)

Flag for disabled indexing, set by the constructor.

  • access: private
Methods
Constructor midcom_services_indexer (line 74)

Initialization

The constructor will initialize the indexer backend using the MidCOM configuration by default. If you need a different indexer backend, you can always explicitly instantinate a backend and pass it ot the constructor. In that case you have to load the corresponding PHP file manually.

midcom_services_indexer midcom_services_indexer ([midcom_services_indexer_backend $backend = null])
delete (line 160)

Removes the document with the given resource identifier from the index.

  • return: Indicating success.
bool delete (string $RI)
  • string $RI: The resource identifier of the document that should be deleted.
delete_all (line 177)

Clear the index completly.

This will drop the current index.

  • return: Indicating success.
bool delete_all ()
index (line 111)

Adds a document to the index.

A finished document object must be passed to this object. If the index already contains a record with the same Resource Identifier, the record is replaced.

Support of batch-indexing using an Array of documents instead of a single document is possible (and strongly advised for performance reasons).

  • return: Indicating success.
bool index (mixed $documents)
  • mixed $documents: One or more documents to be indexed, so this is either a midcom_services_indexer_document or an Array of these objects.
new_document (line 346)

This function tries to instantinate the most specific document class for the object given in the parameter.

This class will not return empty document base class instances if nothing specific can be found. If you are in this situation, you need to instantinate an appropriate document manually and populate it.

The checking sequence is like this right now:

  1. If a datamanager instance is passed, it is transformed into a midcom_services_indexer_document_datamanager.
  2. If a Metadata object is passed, it is transformed into a midcom_services_indexer_document_midcom.
  3. Finally, the method tries to retrieve a MidCOM Metadata object using the parameter directly. If successful, again a midcom_services_indexer_document_midcom is returned.
This factory method will work even if the indexer is disabled. You therefore need to protect your code by checking against the configuration option indexer_backend !== false.

  • return: A valid document class as specific as possible. Returns false on error or if no specific class match could be found.
midcom_services_indexer_document new_document (object &$object)
  • object $object: The object for which a document instance is required, passed by reference.
query (line 203)

Query the index and, if set, restrict the query by a given filter.

The filter argument is optional and may be a subclass of indexer_filter. The backend determines what filters are supported and how they are treated.

The query syntax is also dependant on the backend. Refer to its documentation how queries should be built.

Each result node is looked up in NAP/Metadata to verify its visibility.

  • return: An arary of documents matching the query, or false on a failure.
Array query (string $query, [midcom_services_indexer_filter $filter = null])
  • string $query: The query, which must suite the backends query syntax. It is assumed to be in the site charset.
  • midcom_services_indexer_filter $filter: An optional filter used to restrict the query.
_check_permissions_topic (line 318)
void _check_permissions_topic (mixed $document)

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