Skip to content

Commit 9fbe00d

Browse files
authored
ENG-1142 Short-term repair of queries (#600)
* Revert "ENG-1122 use or-join-clause so the variables are exposed to the optimizer (#584)" This reverts commit b7f1af9. * revert the downgrade of disjunction
1 parent a600d33 commit 9fbe00d

2 files changed

Lines changed: 4 additions & 8 deletions

File tree

apps/roam/src/utils/conditionToDatalog.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ const translator: Record<string, Translator> = {
446446
if (currentUserMatch) {
447447
return [
448448
{
449-
type: "or-join-clause",
449+
type: "or-clause",
450450
clauses: [
451451
{
452452
type: "data-pattern",
@@ -465,7 +465,6 @@ const translator: Record<string, Translator> = {
465465
],
466466
},
467467
],
468-
variables: [{ type: "variable", value: `${source}-String` }],
469468
},
470469
{
471470
type: "pred-expr",
@@ -482,7 +481,7 @@ const translator: Record<string, Translator> = {
482481
const rePattern = regexRePatternValue(target);
483482
return [
484483
{
485-
type: "or-join-clause",
484+
type: "or-clause",
486485
clauses: [
487486
{
488487
type: "data-pattern",
@@ -501,7 +500,6 @@ const translator: Record<string, Translator> = {
501500
],
502501
},
503502
],
504-
variables: [{ type: "variable", value: `${source}-String` }],
505503
},
506504
{
507505
type: "fn-expr",
@@ -530,7 +528,7 @@ const translator: Record<string, Translator> = {
530528

531529
return [
532530
{
533-
type: "or-join-clause",
531+
type: "or-clause",
534532
clauses: [
535533
{
536534
type: "data-pattern",
@@ -549,7 +547,6 @@ const translator: Record<string, Translator> = {
549547
],
550548
},
551549
],
552-
variables: [{ type: "variable", value: `${source}-String` }],
553550
},
554551
{
555552
type: "pred-expr",

apps/roam/src/utils/fireQuery.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,7 @@ const optimizeQuery = (
107107
if (Array.from(allVars).every((v) => capturedVariables.has(v))) {
108108
score = 10;
109109
} else {
110-
// downgrade disjunction and negation
111-
score = c.type === "and-clause" ? 100002 : 100006;
110+
score = 100002;
112111
}
113112
} else if (c.type === "not-join-clause" || c.type === "or-join-clause") {
114113
if (c.variables.every((v) => capturedVariables.has(v.value))) {

0 commit comments

Comments
 (0)