Preserve wikilink text in Obsidian indexing and fix duplicate sync
Two fixes: - Convert wikilinks to display text instead of stripping them entirely. [[Noah]] becomes "Noah", [[target|display]] becomes "display". This was causing names and references in wikilinks to be invisible to search. - Switch _get_obsidian_indexed_files to async engine to avoid stale reads from the separate sync engine, which caused files to be re-indexed every cycle. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -106,8 +106,12 @@ class ObsidianService:
|
||||
embeds = [e.split(":")[0].strip() if ":" in e else e.strip() for e in embeds]
|
||||
|
||||
# Clean body content
|
||||
# Remove wikilinks [[...]] and embeds [[!...]]
|
||||
cleaned_content = re.sub(r"\[\[.*?\]\]", "", body_content)
|
||||
# Remove embeds ![[...]]
|
||||
cleaned_content = re.sub(r"!\[\[.*?\]\]", "", body_content)
|
||||
# Convert wikilinks to display text: [[target|display]] → display, [[target]] → target
|
||||
cleaned_content = re.sub(
|
||||
r"\[\[([^\]|]+\|)?([^\]]+)\]\]", r"\2", cleaned_content
|
||||
)
|
||||
cleaned_content = re.sub(r"\n{3,}", "\n\n", cleaned_content).strip()
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user