(location, documentId, queryText)
| 125 | } |
| 126 | |
| 127 | export function folderDocumentsQuery(location, documentId, queryText) { |
| 128 | // when a query is defined, we switch to recursive folder search - otherwise |
| 129 | // a flat listing of the immediate children of this directory is shown. |
| 130 | const path = documentId ? 'entities' : undefined; |
| 131 | const q = Query.fromLocation(path, location, {}, 'document').getString('q'); |
| 132 | const hasSearch = q.length !== 0 || queryText; |
| 133 | const field = hasSearch |
| 134 | ? 'filter:properties.ancestors' |
| 135 | : 'filter:properties.parent'; |
| 136 | const context = { 'filter:schemata': 'Document', [field]: documentId }; |
| 137 | let query = Query.fromLocation(path, location, context, 'document'); |
| 138 | if (queryText) { |
| 139 | query = query.setString('q', queryText); |
| 140 | } |
| 141 | return query; |
| 142 | } |
| 143 | |
| 144 | export function entitySimilarQuery(location, entityId) { |
| 145 | const path = entityId ? `entities/${entityId}/similar` : undefined; |
no test coverage detected