Details
-
Improvement
-
Resolution: Unresolved
-
Major
-
None
-
7.2.0
-
None
-
0
Description
In the on-prem UI code, the document viewer retrieves documents using multiple API calls:
- In the first call, it uses either the KV document API, or the query service to retrieve a list of document IDs
- Subsequently, it retrieves each individual document using a separate REST call using the KV API.
The reason for this was that, in the past, the `include_docs` argument in the KV REST API didn't work for retrieving more than one document at a time. This was later fixed, and should no longer restrict the UI code.
The relevant code is in `query-ui/query-ui/angular-components/documents/qw.documents.component.js`.
- On line 778, the query is formed as
`select meta().id from...`.
To retrieve the data as well, it should be:
`select meta().id, <collection_name> as data from...`
The result will contain the document id as the field `id`, and the document body as `data`.
- On line 1088, the REST call has `include_docs=false`. Change that to `true` and the call will return document Ids and documents as well.
- After the above calls, the subsequent call to `getDocsForIdArray` that was retrieving the individual documents will no longer be necessary.