-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Labels
bugSomething isn't workingSomething isn't working
Description
If a relation has multiple definitions
We are filtering them from all relations
query-builder/src/utils/getDiscourseContextResults.ts
Lines 42 to 57 in 66caa79
| relations | |
| .flatMap((r) => { | |
| const queries = []; | |
| if (r.source === nodeType || r.source === "*") { | |
| queries.push({ | |
| r, | |
| complement: false, | |
| }); | |
| } | |
| if (r.destination === nodeType || r.destination === "*") { | |
| queries.push({ | |
| r, | |
| complement: true, | |
| }); | |
| } | |
| return queries; |
But in the datalog translator we are doing this again when we build the query
query-builder/src/utils/registerDiscourseDatalogTranslators.ts
Lines 224 to 245 in 66caa79
| const filteredRelations = discourseRelations | |
| .map((r) => | |
| (r.label === label || ANY_RELATION_REGEX.test(label)) && | |
| doesDiscourseRelationMatchCondition(r, { source, target }) | |
| ? { ...r, forward: true } | |
| : doesDiscourseRelationMatchCondition( | |
| { source: r.destination, destination: r.source }, | |
| { source, target } | |
| ) && | |
| (r.complement === label || ANY_RELATION_REGEX.test(label)) | |
| ? { ...r, forward: false } | |
| : undefined | |
| ) | |
| .filter( | |
| ( | |
| r | |
| ): r is ReturnType<typeof getDiscourseRelations>[number] & { | |
| forward: boolean; | |
| } => !!r | |
| ); | |
| if (!filteredRelations.length) return []; | |
| const andParts = filteredRelations.map( |
Resulting in multiple duplicate queries.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
