View Document Service
View Document Service🔗
The View Document Service provides the following functionality for accessing the documents in the search index:
- Rendering an HTML view of the original document from the document store (viewDocument, viewDocumentWithToken)
- Rendering a customizable, language-specific HTML view of the original document directly from the search index (viewTemplatedMetadata, viewTemplatedMetadataWithToken)
Method viewDocument🔗
Method call🔗
viewDocument(environmentName, password, searchEngine, documentID, accessRoles)
Description🔗
The method returns the HTML representation of the indexed document for the given document ID.
Parameters🔗
Parameter Name | Type | Description |
---|---|---|
environment | string | identifier of a search environment |
password | string | password for the search environment |
searchEngine | string | optional: searcher for which to retrieve the document |
documentID | string | the document ID (given at indexing time) for which the original representation should be returned |
accessRoles | list of strings | list of access roles to check document access. Role "all" grants access to all documents. |
Returns🔗
Pre-Condition🔗
- The document store is enabled for the environment.
- The provided environment has a repository (i.e. it is indexing).
Post-Condition🔗
None.
Error Handling🔗
Error Code | Description |
---|---|
EMPTY_ARGUMENT | One or more mandatory arguments are empty. |
INVALID_PASSWORD | The password is incorrect. |
ENVIRONMENT_NOT_AVAILABLE | The environment is not available (see log-file for possible errors). |
DOCUMENT_STORAGE_ERROR | The document can not be retreived from the document store. |
INVALID_DOCUMENT_FORMAT | The document can not be parsed as XML. |
INVALID_ACCESS_ROLES | The document does not allow access to the given access roles. |
DOCUMENT_NOT_FOUND | The document is not found in the document store. |
METHOD_NOT_AVAILABLE | The Cassandra document store is not enabled, or the searcher with the given searchEngine name is not an internal searcher. |
SEARCHER_NOT_FOUND | The searcher with the given searchEngine name is not found. |
Method viewDocumentWithToken🔗
Method call🔗
viewDocumentWithToken(accessToken, searchEngine, documentID)
Description🔗
The same method as viewDocument but with token authentication.
Error Handling🔗
The method can raise the same errors as the corresponding viewDocument method, but can return an INVALID_ACCESS_TOKEN error instead of the INVALID_PASSWORD error.
Method viewTemplatedMetadata🔗
Method call🔗
viewTemplatedMetadata(environmentName, password, searchEngine, documentID, language, template, accessRoles)
Description🔗
The method returns a templated representation of the indexed document's metadata for the given document ID.
Parameters🔗
Parameter Name | Type | Description |
---|---|---|
environment | string | Identifier of a search environment. |
password | string | Password for the search environment. |
searchEngine | string | Optional name of the searchEngine to retrieve the document from, defaults to the first configured searcher. |
documentID | string | The document ID (given at indexing time) to template. |
language | string | The desired output language. |
template | string | The template name to be applied. As a result of the template .vm file application, output in any format can be produced. While HTML (as a result) is commonly used for emails, it can be also JSON, XML, or any other text-based format. |
accessRoles | list of strings | List of access roles to check document access for. Role "all" grants access to all documents. |
Returns🔗
Pre-Condition🔗
- Document templating is enabled for the environment.
- One or more templates are configured for the environment.
Post-Condition🔗
None.
Error Handling🔗
Error Code | Description |
---|---|
EMPTY_ARGUMENT | One or more mandatory arguments are empty. |
INVALID_PASSWORD | The password is incorrect. |
ENVIRONMENT_NOT_AVAILABLE | The environment is not available (see log-file for possible errors). |
SEARCH_EXECUTION_ERROR | The document can not be retrieved from the searcher. |
INVALID_ACCESS_ROLES | The document does not allow access to the given access roles. |
DOCUMENT_NOT_FOUND | The document is not found in the index. |
SEARCHER_NOT_FOUND | The specified searcher is not found or not an searcher. |
TEMPLATE_ERROR | The velocity template is not found or contains errors. |
Method viewTemplatedMetadataWithToken🔗
Method call🔗
viewTemplatedMetadata(accessToken, searchEngine, documentID, language, template)
Description🔗
The same method as viewTemplatedMetadata but with token authentication.
Error Handling🔗
The method can raise the same errors as the corresponding viewTemplatedMetadata method, but can return an INVALID_ACCESS_TOKEN error instead of the INVALID_PASSWORD error.