MCPcopy Create free account
hub / github.com/alephdata/aleph / folderDocumentsQuery

Function folderDocumentsQuery

ui/src/queries.js:127–142  ·  view source on GitHub ↗
(location, documentId, queryText)

Source from the content-addressed store, hash-verified

125}
126
127export 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
144export function entitySimilarQuery(location, entityId) {
145 const path = entityId ? `entities/${entityId}/similar` : undefined;

Callers 3

mapStateToPropsFunction · 0.90
mapStateToPropsFunction · 0.90
mapStateToPropsFunction · 0.90

Calls 3

getStringMethod · 0.80
fromLocationMethod · 0.80
setStringMethod · 0.80

Tested by

no test coverage detected