diff options
| author | bobzel <zzzman@gmail.com> | 2020-08-14 11:23:02 -0400 |
|---|---|---|
| committer | bobzel <zzzman@gmail.com> | 2020-08-14 11:23:02 -0400 |
| commit | 92d838267111403b6503400652d185aae9cb2964 (patch) | |
| tree | 7736e10d8917d867363cc069d75f24ce8e2964b8 /src/client/util/SearchUtil.ts | |
| parent | c628c9305ea5e28f577b5b040a30d7c8aaea3e8c (diff) | |
| parent | 19ca5143d050368284ab91ad4a096a674fe84646 (diff) | |
Merge branch 'master' into bug_fixes_melissa
Diffstat (limited to 'src/client/util/SearchUtil.ts')
| -rw-r--r-- | src/client/util/SearchUtil.ts | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/client/util/SearchUtil.ts b/src/client/util/SearchUtil.ts index a66cce6a5..b63fc8991 100644 --- a/src/client/util/SearchUtil.ts +++ b/src/client/util/SearchUtil.ts @@ -37,8 +37,8 @@ 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:([^ )])/, (substring, arg) => `{!join from=id to=proto_i}type_t:${arg}`); - const gotten = await rp.get(rpquery, { qs: { ...options, /* sort: "lastModified_d desc", */ q: replacedQuery } }); + const replacedQuery = query.replace(/type_t:([^ )])/g, (substring, arg) => `{!join from=id to=proto_i}type_t:${arg}`); + 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) { return result; @@ -83,7 +83,7 @@ export namespace SearchUtil { } } - return { docs: theDocs, numFound: theDocs.length, highlighting, lines: theLines }; + return { docs: theDocs, numFound: result.numFound, highlighting, lines: theLines }; } export async function GetAliasesOfDocument(doc: Doc): Promise<Doc[]>; |
