mirror of
https://github.com/morluto/rea.git
synced 2026-11-07 07:16:13 +00:00
fix(javascript): scope candidate ambiguity to query traversal
This commit is contained in:
1 parent
5802ef8746
commit
f94fc7967b
2 files changed
+205
-11
No files matched your search
@@ -281,17 +281,15 @@ const relevantCandidateRelationCount = (
|
||||
nodeIds: ReadonlySet<string>,
|
||||
input: JavaScriptSemanticQueryInput,
|
||||
): number => {
|
||||
const allowed =
|
||||
input.allowed_relations === undefined
|
||||
? null
|
||||
: new Set(input.allowed_relations);
|
||||
return graph.relations.filter(
|
||||
(relation) =>
|
||||
relation.resolution === "candidate" &&
|
||||
(allowed === null || allowed.has(relation.relation)) &&
|
||||
(nodeIds.has(relation.source_node_id) ||
|
||||
nodeIds.has(relation.target_node_id)),
|
||||
).length;
|
||||
const adjacency = buildAdjacency(
|
||||
graph.relations.filter(({ resolution }) => resolution === "candidate"),
|
||||
{ ...input, include_ambiguous_dynamic_edges: true },
|
||||
);
|
||||
const relevant = new Set<string>();
|
||||
for (const nodeId of nodeIds)
|
||||
for (const { relation } of adjacency.get(nodeId) ?? [])
|
||||
relevant.add(relation.relation_id);
|
||||
return relevant.size;
|
||||
};
|
||||
|
||||
const expectedMatchesFor = (
|
||||
|
||||
Reference in new issue
Block a user