Skip to content

Commit 9077623

Browse files
committed
Fix link search around
1 parent 0a684d4 commit 9077623

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

src/expression/parser.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,8 @@ export const QUERY = P.createLanguage<QueryLanguage>({
555555
queryLinked: (q) =>
556556
createFunction(P.regexp(/linksto|linkedfrom|connected/i).desc("connected"), q.query).map(([func, source]) => ({
557557
type: "linked",
558-
source,
558+
// When writing syntax like `linksto([[link]])`, [[link]] will also be interpreted as a linked query, so unwrap it if present.
559+
source: source.type == "linked" && source.source.type == "link" ? source.source : source,
559560
direction:
560561
func.toLowerCase() == "linksto" ? "incoming" : func.toLowerCase() == "linkedfrom" ? "outgoing" : "both",
561562
})),

src/index/datastore.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ export class Datastore {
562562
if (visited.has(neighbor)) continue;
563563

564564
visited.add(neighbor);
565-
if (dist < distance) queue.push(neighbor, dist + 1);
565+
if (dist + 1 < distance) queue.push(neighbor, dist + 1);
566566
}
567567
}
568568

0 commit comments

Comments
 (0)