diff options
| author | eeng5 <eleanor_eng@brown.edu> | 2020-02-09 14:59:57 -0500 |
|---|---|---|
| committer | eeng5 <eleanor_eng@brown.edu> | 2020-02-09 14:59:57 -0500 |
| commit | daa8898f70bd44d2716f1f0d3371a8435a3ff638 (patch) | |
| tree | ccb2ea544eeed0413370cdd69e758faec6170690 /src/client/util/SearchUtil.ts | |
| parent | 1e36055e3674fe33dd39f6ad79c969531f7b447c (diff) | |
| parent | f6179334d6f2942631caa17b7c8ae2531d87c7c4 (diff) | |
Merge branch 'pen' of https://github.com/browngraphicslab/Dash-Web into pen
Diffstat (limited to 'src/client/util/SearchUtil.ts')
| -rw-r--r-- | src/client/util/SearchUtil.ts | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/src/client/util/SearchUtil.ts b/src/client/util/SearchUtil.ts index 8ff54d052..64874b994 100644 --- a/src/client/util/SearchUtil.ts +++ b/src/client/util/SearchUtil.ts @@ -118,4 +118,27 @@ 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: + { start: 0, rows: 10000, q: query }, + + }); + let result: IdSearchResult = JSON.parse(response); + const { ids, numFound, highlighting } = result; + //console.log(ids.length); + const docMap = await DocServer.GetRefFields(ids); + const docs: Doc[] = []; + for (const id of ids) { + const field = docMap[id]; + if (field instanceof Doc) { + docs.push(field); + } + } + return docs; + // const docs = ids.map((id: string) => docMap[id]).filter((doc: any) => doc instanceof Doc); + // return docs as Doc[]; + } +} |
