diff options
author | usodhi <61431818+usodhi@users.noreply.github.com> | 2020-08-17 23:29:33 +0530 |
---|---|---|
committer | usodhi <61431818+usodhi@users.noreply.github.com> | 2020-08-17 23:29:33 +0530 |
commit | 2e2ac8116f7ba41c8652ba1ca02ccdc4ca11ed03 (patch) | |
tree | fd081de8a3b2d9a6fb44bc36985b08c5407a2f53 /src/client/util/SearchUtil.ts | |
parent | 8f180cd9ef75eb1aaa6fed9e6544b7b6256cda73 (diff) | |
parent | 2c1e3a0c657914c7426ac7347bdb2781e1fa49bd (diff) |
Merge branch 'acls_uv' of https://github.com/browngraphicslab/Dash-Web into acls_uv
Diffstat (limited to 'src/client/util/SearchUtil.ts')
-rw-r--r-- | src/client/util/SearchUtil.ts | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/client/util/SearchUtil.ts b/src/client/util/SearchUtil.ts index b63fc8991..6dafbd58e 100644 --- a/src/client/util/SearchUtil.ts +++ b/src/client/util/SearchUtil.ts @@ -29,6 +29,7 @@ export namespace SearchUtil { rows?: number; fq?: string; allowAliases?: boolean; + onlyAliases?: boolean; "facet"?: string; "facet.field"?: string; } @@ -37,7 +38,10 @@ export namespace SearchUtil { export async function Search(query: string, returnDocs: boolean, options: SearchParams = {}) { query = query || "*"; //If we just have a filter query, search for * as the query const rpquery = Utils.prepend("/dashsearch"); - const replacedQuery = query.replace(/type_t:([^ )])/g, (substring, arg) => `{!join from=id to=proto_i}type_t:${arg}`); + let replacedQuery = query.replace(/type_t:([^ )])/g, (substring, arg) => `{!join from=id to=proto_i}type_t:${arg}`); + if (options.onlyAliases) { + replacedQuery = `{!join from=id to=proto_i}DEFAULT:${replacedQuery}`; + } const gotten = await rp.get(rpquery, { qs: { ...options, sort: "lastModified_d desc", q: replacedQuery } }); const result: IdSearchResult = gotten.startsWith("<") ? { ids: [], docs: [], numFound: 0, lines: [] } : JSON.parse(gotten); if (!returnDocs) { |