It allows you to maintain and query the document index.
Do not instantiate 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.
|todo||Batch indexing support|
|todo||Write code examples|
|todo||More elaborate class introduction.|
The constructor will initialize the indexer backend using the MidCOM configuration by default. If you need a different indexer backend, you can always explicitly instantiate a backend and pass it to the constructor. In that case you have to load the corresponding PHP file manually.
\midcom_services_indexer_backendAn explicit indexer to initialize with.
Using GUIDs instead of RIs will delete all language versions
arrayThe resource identifier(s) of the document(s) that should be deleted.
This will drop the current 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).
mixedOne or more documents to be indexed, so this is either a midcom_services_indexer_document or an Array of these objects.
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 instantiate an appropriate document manually and populate it.
The checking sequence is like this right now:
This factory method will work even if the indexer is disabled. You can check this with the enabled() method of this class.
|todo||Move to a full factory pattern here to save document php file parsings where possible. This means that all document creations will in the future be handled by this method.|
object&$object The object for which a document instance is required, passed by reference.
\midcom_services_indexer_documentA valid document class as specific as possible. Returns false on error or if no specific class match could be found.
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 dependent on the backend. Refer to its documentation how queries should be built.
|todo||Refactor into multiple methods|
stringThe query, which must suit the backends query syntax. It is assumed to be in the site charset.
\midcom_services_indexer_filterAn optional filter used to restrict the query.
ArrayAn array of documents matching the query, or false on a failure.
Where necessary (f.x. with the DM instances) automatic indexing of subclasses is done.
Note, that this is conceptually different from the public new_document operation: It might already trigger indexing of dependent objects: A datamanager instance for example will automatically reindex all BLOBs defined in the schema.
\midcom_helper_datamanager2_datamanager&$object A reference to the DM2 object