diff options
author | ab <abdullah_ahmed@brown.edu> | 2019-11-16 12:28:12 -0500 |
---|---|---|
committer | ab <abdullah_ahmed@brown.edu> | 2019-11-16 12:28:12 -0500 |
commit | f7e101dfc7bc9e81ca03730865740360a831285a (patch) | |
tree | 8fd94d15bf573890882d746cbca065bfd5993cb9 /src/client/util/SearchUtil.ts | |
parent | d26e058019d878d3058cb3806855281076b8d411 (diff) | |
parent | 22d1e65236bae11c508d5c34ebcbddd1a552bfd8 (diff) |
merged
Diffstat (limited to 'src/client/util/SearchUtil.ts')
-rw-r--r-- | src/client/util/SearchUtil.ts | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/client/util/SearchUtil.ts b/src/client/util/SearchUtil.ts index fb3189069..a8f4013f4 100644 --- a/src/client/util/SearchUtil.ts +++ b/src/client/util/SearchUtil.ts @@ -28,6 +28,7 @@ export namespace SearchUtil { start?: number; rows?: number; fq?: string; + allowAliases?: boolean; } export function Search(query: string, returnDocs: true, options?: SearchParams): Promise<DocSearchResult>; export function Search(query: string, returnDocs: false, options?: SearchParams): Promise<IdSearchResult>; @@ -73,7 +74,7 @@ export namespace SearchUtil { const docs = ids.map((id: string) => docMap[id]).map(doc => doc as Doc); for (let i = 0; i < ids.length; i++) { let testDoc = docs[i]; - if (testDoc instanceof Doc && testDoc.type !== DocumentType.KVP && theDocs.findIndex(d => Doc.AreProtosEqual(d, testDoc)) === -1) { + if (testDoc instanceof Doc && testDoc.type !== DocumentType.KVP && (options.allowAliases || theDocs.findIndex(d => Doc.AreProtosEqual(d, testDoc)) === -1)) { theDocs.push(testDoc); theLines.push([]); } @@ -88,9 +89,9 @@ export namespace SearchUtil { const proto = Doc.GetProto(doc); const protoId = proto[Id]; if (returnDocs) { - return (await Search("", returnDocs, { fq: `proto_i:"${protoId}"` })).docs; + return (await Search("", returnDocs, { fq: `proto_i:"${protoId}"`, allowAliases: true })).docs; } else { - return (await Search("", returnDocs, { fq: `proto_i:"${protoId}"` })).ids; + return (await Search("", returnDocs, { fq: `proto_i:"${protoId}"`, allowAliases: true })).ids; } // return Search(`{!join from=id to=proto_i}id:${protoId}`, true); } |