diff options
| author | ab <abdullah_ahmed@brown.edu> | 2019-08-09 17:04:25 -0400 |
|---|---|---|
| committer | ab <abdullah_ahmed@brown.edu> | 2019-08-09 17:04:25 -0400 |
| commit | b8ab5a823ae22b021c09dfd713b77211a51b3eae (patch) | |
| tree | f6c6def42f40b6c9e92562ad56d3c0e515cb94e1 /src/client/util/SearchUtil.ts | |
| parent | 116f218c2eeec377fb465027bcfaa7521d9af492 (diff) | |
idk man
Diffstat (limited to 'src/client/util/SearchUtil.ts')
| -rw-r--r-- | src/client/util/SearchUtil.ts | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/client/util/SearchUtil.ts b/src/client/util/SearchUtil.ts index ee5a83710..3a3ba1803 100644 --- a/src/client/util/SearchUtil.ts +++ b/src/client/util/SearchUtil.ts @@ -77,4 +77,23 @@ export namespace SearchUtil { aliasContexts.forEach(result => contexts.aliasContexts.push(...result.ids)); return contexts; } -}
\ No newline at end of file + + export async function GetAllDocs() { + const query = "*"; + let response = await rp.get(Utils.prepend('/search'), { + qs: { + query + } + }); + let res: string[] = JSON.parse(response); + const fields = await DocServer.GetRefFields(res); + const docs: Doc[] = []; + for (const id of res) { + const field = fields[id]; + if (field instanceof Doc) { + docs.push(field); + } + } + return docs; + } +} |
