This issue has been created
 
 
LLM AI Integration / cid:jira-generated-image-avatar-4d110169-0ad5-47af-a8d4-53032169c8e7 LLMAI-176 Open

Raw wiki syntax is fed to the embedder instead of rendered plain text

 
View issue   ·   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-19271542-280d-4e2f-9a3f-432ad4ae7d60 Sebastian Elsner created this issue on 17/Aug/26 16:01
 
Summary: Raw wiki syntax is fed to the embedder instead of rendered plain text
Issue Type: cid:jira-generated-image-avatar-4d110169-0ad5-47af-a8d4-53032169c8e7 Improvement
Affects Versions: 0.9
Assignee: Unassigned
Created: 17/Aug/26 16:01
Environment: XWiki 18.6.0, ai-llm 0.9.
Priority: cid:jira-generated-image-static-major-63bfb61f-5e4e-40a0-a11b-f419caf059ee Major
Reporter: Sebastian Elsner
Description:

What happens

XWikiDocumentDocument.getContent(), which supplies the text that is chunked and embedded, uses the raw document source:

formatHeading(1, this.xWikiDocument.getRenderedTitle(this.xWikiDocument.getSyntax(), context))
    + this.xWikiDocument.getContent()

xWikiDocument.getContent() returns the unrendered source, so macro syntax, HTML, inline CSS style attributes, and image and link syntax all reach the embedder verbatim. Note that getTitle(), immediately above in the same class, does render, via Syntax.PLAIN_1_0 – so the inconsistency is within one class.

Why it matters

Markup is embedded as if it were prose. That dilutes the vector for the page's actual content, and it creates chunks that are almost entirely noise yet still occupy a result slot in every search.

Observed

A chunk retrieved and cited for an unrelated question consists almost entirely of Dark Reader style attributes that had been injected into the page source:

(% style="--darkreader-inline-color:var(--darkreader-text-19177c, #c0bbb4); color:#19177c" %)SOFTWARE(% style="--darkreader-inline-color:var(--darkreader-text-666666, #bfb199); color:#666666" %)=(%%)nuke

Other retrieved chunks carried velocity and box macro syntax and image link syntax.

Suggested fix

Render the document to Syntax.PLAIN_1_0 before chunking, the way getTitle() already does. Existing collections would need a re-index to benefit, which the application already supports.