What does turning a ticket thread or wiki page into clean text for a retrieval index involve, and which source metadata do you keep?
answer
- the words people wrote, nothing else
- chrome, macros and quoted replies
- structure the next steps need
- enough to cite, filter and re-sync
basics
~20 sStrip what the source added around the writing (navigation, macros, signatures, quoted replies, bot notes), keep headings, tables and code blocks, and keep metadata to cite, filter and re-sync: source ID, URL, title, path, author, timestamps, status, access list.
solid answer
~50 sSource content arrives as markup full of things nobody wrote: navigation, page trees, macros, embedded widgets, and in tickets, email signatures, quoted earlier replies and bot comments like 'status changed to resolved'. Left in, that boilerplate can repeat across thousands of chunks and pollute retrieval. So I convert to plain text or light markup, **keep structure** later steps need (headings, lists, tables with their header row, code blocks), resolve or reference included content instead of duplicating it, and send attachments to the document-extraction path. A ticket becomes one document: title and description, then comments in time order with the author's role and an internal-or-public flag. Then **metadata**: a stable source ID, the URL and title for citations, the space or project path, author, created and updated times, version, status such as resolved or archived, labels and the access list, so answers can cite, filter and be kept in sync.
go deeper
Recall what to strip (chrome, macros, signatures, quoted replies, bot notes) and what to keep (headings, tables, code, the source ID, URL and title).
Explain why repeated boilerplate hurts retrieval, how to order a ticket thread with author roles, and why included pages should not be copied into every page that includes them.
Show that cleaning carries correctness, not only quality: internal notes need a narrower access list, a stable source ID keeps re-syncs from duplicating, and status lets the assistant tell fixed from open.
Decide how much per-source cleaning code the team maintains against a generic converter, given that each source's markup drifts with its releases and every converter needs tests on real samples.
## What the connector receives A connector does not receive text; it receives whatever the source's API returns. For a **team wiki** that is usually HTML or the wiki's own markup, with macros, embedded widgets, page-tree navigation, breadcrumbs and "related pages" panels. For a **ticket tracker** it is a structured record (title, description, status, priority, assignee) plus a list of comments, many of which arrived as emails. The goal of cleaning is the text people actually wrote, in a form the chunker and the embedding model can use, with enough metadata to cite it and keep it in step with the source. ## Wiki pages: strip the chrome, keep the structure - **Remove page chrome**: navigation, breadcrumbs, sidebars, footers, "last edited by" banners. The same chrome on every page becomes thousands of near-identical chunks that crowd real answers out of retrieval. - **Resolve or reference macros**: a status badge becomes a word; a table of contents is dropped; an **included page** (content pulled in from another page) is either referenced or left to its own document, so the same text is not indexed in every page that includes it. - **Keep headings** as structure markers; how chunks are cut on them is a chunking decision made later. - **Render tables** row by row with their header labels, so "Owner: payments team" survives rather than a flattened run of cells. - **Keep code blocks** verbatim, since engineers ask about exact commands and error strings. - **Keep link text** and record targets as metadata; turn images into their alt text. - **Send attachments** to the document-extraction path; reading text out of PDFs and scans is its own problem. ## Ticket threads: one conversation, minus the noise - **Order comments by time** and keep the author's **role** (requester, agent, automation), because "the customer said" and "the engineer said" mean different things. - **Strip email residue**: signatures, legal footers and **quoted earlier replies**, which duplicate comments already in the thread. - **Drop automated notes** such as field changes, or collapse them into the ticket's current status. - **Keep the visibility flag**: an internal note hidden from the requester must get a narrower access list than the public replies. - **Keep the outcome**: status and resolution tell the assistant whether a thread describes a fix or an open problem. ## Metadata to keep | Field | Why | |---|---| | Stable source ID | Re-syncs update the same document instead of adding a copy | | Source type and URL | Citations link back to the original | | Title and path (space, folder, project) | Citation text, filters, context for readers | | Author and roles | Trust and filtering ("what did the on-call team write?") | | Created and updated times, version | Recency filters and sync checks | | Status, archived flag, labels | Excluding stale or closed content | | Access list | Every chunk must carry who may read it | | Language | Routing to the right processing | ```json { "source_id": "tickets:48210", "url": "https://example.com/tickets/48210", "title": "Refund stuck in pending after card change", "path": ["Support", "Billing"], "status": "resolved", "updated_at": "2026-10-12T16:40:00Z", "body": "Customer (requester): The refund shows pending...\nAgent: Fixed by re-issuing the refund...", "comments_internal": 2, "access": ["group:support-billing"] } ``` The field names and the domain above are invented for illustration. ## Checking the cleaner Cleaning code breaks quietly when a source changes its markup in a release, so it needs checks of its own: - **Golden samples.** Keep a few dozen real pages and tickets per source with their expected clean text, and compare on every change to the cleaner. - **Boilerplate ratio.** Measure how many chunks are near-identical across unrelated documents; a jump usually means a new piece of chrome is leaking through. - **Empty and tiny documents.** Count documents that clean down to almost nothing; a macro the cleaner no longer understands often deletes the content it wrapped. ## Common mistakes 1. **Indexing raw markup.** Tags and macro syntax waste embedding input and distort similarity. 2. **Keeping quoted replies.** The same paragraph lands in five chunks and dominates retrieval. 3. **Dropping metadata to save space.** Without a stable ID and URL the pipeline cannot re-sync or cite. 4. **Flattening internal notes into the public thread.** Hidden content then inherits the ticket's wider access list.
- A wiki page embeds a second page through an include. Do you index the included text in both?Usually not. Index the included page as its own document and keep a reference, or a short marker, in the including page. Otherwise every page that includes it carries a copy, retrieval returns duplicates, and an edit to the included page leaves stale copies in every including page until each is re-synced.
- Should automated status-change comments be kept at all?Rarely as text. They add noise to retrieval, but the facts they carry matter, so fold them into the ticket's current status, resolution and timestamps in metadata, and keep the history only where users actually ask about it, such as when a ticket was escalated.
- Index the raw HTML; the embedding model ignores the tags.
- Quoted earlier replies add useful context to each comment.
- Metadata only matters for display, so keep the title and drop the rest.
- Every comment on a ticket shares the ticket's permissions.
- Flatten tables into one line of cell values to save space.