!7 sclass Entry { S line; S rule; S varMap; S judgement; S matchedRuleStruct; S context; sS _fieldOrder = "line rule varMap judgement matchedRuleStruct context"; } cmodule SearchForStatements > DynObjectTable { transient ReliableSingleThread rstSearch = dm_rst(this, r search); transient Flag cancel; start { set fieldsInOrder; } visualize { ret withCenteredButtons(super.visualize(), "Search", rstSearch); } void search { new Flag cancel; this.cancel = cancel; new L list; GazelleEvalContext ctx = dm_gazelle_stdEvalContext(dm_gazelle_rulesOnFacts()); // "john doe is a guy" L lines = dm_discord_allLines(); print("Scanning " + n2(lines, "line")); blubb: for (GazelleLine line : lines) pcall { for (GazelleTree t : gazelle_getChildren(GazelleTree(ctx, line.text))) pcall { if (cancel! || l(list) >= 1000) { print("Cancel"); break blubb; } list.add(nu Entry( line := t.parent.line, varMap := struct(t.varMap()), rule := t.ruleID(), matchedRuleStruct := struct(t.mr), context := "discord msg " + line.msgID)); } } print("Scan yielded " + n2(list, "entry", "entries")); setList(list); } // API L entriesForRule(S ruleID) { ret filterWhere(list(), rule := ruleID); } }