aboutsummaryrefslogtreecommitdiff
path: root/src/client/util/SearchUtil.ts
diff options
context:
space:
mode:
authorJoanne <zehan_ding@brown.edu>2025-05-12 20:58:01 -0400
committerJoanne <zehan_ding@brown.edu>2025-05-12 20:58:01 -0400
commitcd93c88b8fee83a99342eac4dc60f7b4373fa843 (patch)
treeb00d1f46c802752c90e54bb21be785a05e05195e /src/client/util/SearchUtil.ts
parent4997c3de20a381eac30224a7a550afa66174f07d (diff)
parent3a733aa0fd24517e83649824dec0fc8bcc0bde43 (diff)
added tutorial tool, still need to integrate with metadatatool
Diffstat (limited to 'src/client/util/SearchUtil.ts')
-rw-r--r--src/client/util/SearchUtil.ts11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/client/util/SearchUtil.ts b/src/client/util/SearchUtil.ts
index 733eae5f4..fc3bb99ab 100644
--- a/src/client/util/SearchUtil.ts
+++ b/src/client/util/SearchUtil.ts
@@ -9,11 +9,11 @@ export namespace SearchUtil {
export type HighlightingResult = { [id: string]: { [key: string]: string[] } };
export function SearchCollection(collectionDoc: Opt<Doc>, queryIn: string, matchKeyNames: boolean, onlyKeys?: string[]) {
- const blockedTypes = [DocumentType.PRESELEMENT, DocumentType.CONFIG, DocumentType.KVP, DocumentType.FONTICON, DocumentType.BUTTON, DocumentType.SCRIPTING];
+ const blockedTypes = [DocumentType.PRESSLIDE, DocumentType.CONFIG, DocumentType.KVP, DocumentType.FONTICON, DocumentType.BUTTON, DocumentType.SCRIPTING];
const blockedKeys = matchKeyNames
? []
: Object.entries(DocOptions)
- .filter(([, info]: [string, FInfo]) => !info?.searchable())
+ .filter(([, info]: [string, FieldType | FInfo | undefined]) => (info instanceof FInfo ? !info.searchable() : true))
.map(([key]) => key);
const exact = queryIn.startsWith('=');
@@ -21,9 +21,8 @@ export namespace SearchUtil {
const results = new ObservableMap<Doc, string[]>();
if (collectionDoc) {
- const docs = DocListCast(collectionDoc[Doc.LayoutFieldKey(collectionDoc)]);
- // eslint-disable-next-line @typescript-eslint/ban-types
- const docIDs: String[] = [];
+ const docs = DocListCast(collectionDoc[Doc.LayoutDataKey(collectionDoc)]);
+ const docIDs: string[] = [];
SearchUtil.foreachRecursiveDoc(docs, (depth: number, doc: Doc) => {
const dtype = StrCast(doc.type) as DocumentType;
if (dtype && !blockedTypes.includes(dtype) && !docIDs.includes(doc[Id]) && depth >= 0) {
@@ -77,7 +76,7 @@ export namespace SearchUtil {
// eslint-disable-next-line no-loop-func
docs.filter(d => d && !visited.includes(d)).forEach(d => {
visited.push(d);
- const fieldKey = Doc.LayoutFieldKey(d);
+ const fieldKey = Doc.LayoutDataKey(d);
const annos = !Field.toString(Doc.LayoutField(d) as FieldType).includes('CollectionView');
const data = d[annos ? fieldKey + '_annotations' : fieldKey];
data && newarray.push(...DocListCast(data));