View Document Service
View Document Service🔗
The View Document Service provides the following functionality for accessing the documents in the search index:
- Returning the original document from the document store (getDocument, getDocumentWithToken)
- 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)
- Rendering a HTML view of the original document from an external searcher repository (viewExternalDocumentWithToken)
Method getDocument🔗
Method call🔗
getDocument(environmentName, password, searchEngine, documentID, accessRoles)
Description🔗
The method returns the indexed document with the given document ID (updates to the documents are not reflected).
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 retrieved from the document store. |
INVALID_ACCESS_ROLES | The given access roles do not allow access to the document. |
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 getDocumentWithToken🔗
Method call🔗
getDocumentWithToken(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 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 HTML representation of the indexed document 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 (contact Textkernel Support for possible options) |
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.
Method viewExternalDocumentWithToken🔗
Method call🔗
viewExternalDocumentWithToken(accessToken, searchEngine, url, ip, uuid)
Description🔗
The method returns the HTML representation of the external document for the given URL via the Search backend. Based on the given (configured) searchEngine, necessary authentication and processing is performed to be able to retrieve the document represented by the given URL. Should only be used for external searchers that required backend authentication and where the document can be completely retrieved as-is over HTTP GET. Currently, this method is only required and supported by the Broadbean external seachers.
Parameters🔗
Parameter Name | Type | Description |
---|---|---|
accessToken | string | access token that corresponds to the current session. |
searchEngine | string | searcher for which to retrieve the document. |
url | string | the URL where the external document can be found. |
ip | strings | Optional, only required when viewing from BroadBean channels. IP address of the request origin. |
uuid | strings | Optional, only required when viewing from BroadBean channels. Unique persistent identifier for the user's browser or device. |
Returns🔗
returns the HTML representation of the external document.
Error Handling🔗
Error Code | Description |
---|---|
EMPTY_ARGUMENT | One or more mandatory arguments are empty. |
INVALID_ACCESS_TOKEN | The access token is invalid. |
ENVIRONMENT_NOT_AVAILABLE | The environment is not available (see log-file for possible errors). |
SEARCHER_NOT_FOUND | The searcher with the given searchEngine name is not found. |
SEARCHER_ACCESS_DENIED | The user does not have access to the given searcher |
EXTERNAL_ERROR | Something unexpected happened on the side of the external searcher. (see log-file for possible errors). |