Short answer: keep identity and listing text on separate trust paths, attach an expiry policy to every chunk, and make retrieval return only records whose privacy state is valid at query time. This architecture preserves useful discovery while making deletion, consent changes, and audit reconstruction explicit rather than hopeful.
The decision record: two paths, three invariants
Real-estate discovery looks like a search problem, but the dangerous data is usually adjacent to the listing: owner names, phone numbers, precise access instructions, agent notes, and a user’s saved-search history. A retrieval-augmented generation (RAG) system can expose that material through a generated answer even when the visible listing page appears clean. The RAG research paper describes the basic pattern as a generator conditioned on retrieved passages; the privacy boundary therefore has to exist before generation, not in a post-processing disclaimer.
I use three invariants for this design. A query may retrieve a listing only when its authorization scope matches the requester. A chunk may be embedded only after fields outside the public discovery contract are removed or tokenized. Finally, a result must carry freshness metadata, so an expired or withdrawn listing cannot be treated as current merely because its vector remains in an index.
The architecture has a public-search path and a restricted-operations path. The public path contains normalized address bands, neighborhood labels, amenities, and listing copy approved for discovery. The restricted path stores contact and transaction details behind an access service; it is never a source collection for the public retriever. Separate encryption keys, logs, and retention jobs make accidental joins visible in code review and in audit records.
The boundary is deliberate.
| Choice | Strength | Cost or boundary |
|---|---|---|
| One shared index for all fields | Simple ingestion and ranking | A filter mistake can disclose private attributes; deletion scope is hard to prove |
| Split indexes by trust level | Clear authorization boundary and smaller blast radius | Duplicate pipelines and more operational bookkeeping |
| Freshness checked only during ingestion | Cheap query path | Withdrawals and consent changes remain visible until the next rebuild |
| Freshness checked at query time too | Correct behavior after a withdrawal or expiry | Adds a policy lookup and requires measurable latency budgets |
The rejected option is the shared index with a metadata filter bolted on later. It is valid for an internal prototype with synthetic listings, where no real person or address is represented. It is not suitable for production discovery: metadata filters are only as trustworthy as every writer that can omit or alter them, and an LLM can still quote a passage that passed an overly broad filter.
How should retrieval architecture handle privacy controls and freshness for real-estate listing discovery?
Start with a data contract, not an embedding model. Each listing chunk should include a stable listing identifier, a revision number, an audience label, a consent or publication state, and an expires_at timestamp. The text payload should be the minimum needed to answer discovery queries. Exact unit numbers, lockbox instructions, and personal contact fields belong in a separately authorized lookup, if they belong in the system at all.
Chunking is a privacy decision. A 1,500-token chunk that combines description, agent remarks, and showing instructions creates a single high-value leakage unit. Consider a listing revised at 09:00: the public description says “open house Saturday,” while an agent note in the same chunk says the owner will be away and includes a direct number. At 09:05 the owner withdraws that note, but a nearest-neighbor result can still carry the old passage if the index treats the listing as one indivisible document. Smaller chunks aligned to a listing section keep the public description useful while isolating the note for a different policy. They can lose context and increase ranking work, so I keep a short overlap only between public sections and never across trust levels. I then test recall on queries such as “two-bedroom near transit” against a labeled set of redacted listings, and separately test that a query for “contact the owner” returns no public passage. Your mileage may vary when descriptions are unusually terse; the right overlap is an observed retrieval metric, not a fashionable constant.
Freshness needs two clocks. Ingestion records the source revision and publication deadline. Query-time policy checks the current revision, state, and audience before a passage is admitted to the generator. A tombstone event must be durable and idempotent: replaying it should produce the same index state and an audit entry, never resurrect a withdrawn property.
Critical path in Go
The following sketch keeps policy enforcement in front of generation. It is intentionally vendor-neutral; the interfaces can be backed by a hosted search service or a self-managed index.
package retrieval
import (
"context"
"time"
)
type Passage struct {
ListingID string
Revision int64
Audience string
ExpiresAt time.Time
Text string
}
type Policy interface {
Current(ctx context.Context, listingID string) (revision int64, state string, audience string, err error)
}
type Index interface {
Search(ctx context.Context, query, audience string, limit int) ([]Passage, error)
}
func Retrieve(ctx context.Context, q string, now time.Time, p Policy, idx Index) ([]Passage, error) {
candidates, err := idx.Search(ctx, q, "public-discovery", 20)
if err != nil {
return nil, err
}
accepted := make([]Passage, 0, len(candidates))
for _, c := range candidates {
rev, state, audience, err := p.Current(ctx, c.ListingID)
if err != nil || state != "published" || audience != c.Audience || rev != c.Revision {
continue
}
if !c.ExpiresAt.IsZero() && !now.Before(c.ExpiresAt) {
continue
}
accepted = append(accepted, c)
}
return accepted, nil
}
The important behavior is the negative path: a stale, private, or mismatched revision disappears before prompt assembly. Log the decision with a request identifier, policy version, listing revision, and reason code, but do not log the raw private text. That gives a ledger-like audit trail without creating a second shadow database of sensitive content.
Operating the boundary under change
Deletion and consent changes are distributed-systems events. Use an append-only event stream or equivalent durable queue, make consumers idempotent, and monitor the lag between an event timestamp and the last index acknowledgement. A useful alert is not “vector count changed”; it is “a withdrawn revision was still eligible after the policy deadline.” Periodic reconciliation should compare source-of-truth revisions with index revisions and produce a reviewable diff.
Evaluation must include privacy negatives. Test a public query against a fixture containing a phone number, an exact apartment number, and an internal note, then assert that none can reach retrieved context or generated citations. Test replayed tombstones, clock skew around expires_at, and a listing that changes audience without changing its prose. These cases are more informative than a single aggregate relevance score.
There is a compliance limit worth stating plainly: an audit log and a deletion job do not by themselves establish legal compliance. Retention, access rights, and regional obligations vary, so involve the privacy owner and document the applicable policy. I'm not sure any generic benchmark can capture that organizational decision; it must be resolved outside the ranker.
The catch is operational weight. Split trust paths, query-time checks, and reconciliation consume engineering time and add latency. They are not suitable for a throwaway demo using synthetic data. Stick with a simpler index when the corpus is intentionally public, immutable, and non-personal; move to the split design when listings can be withdrawn, personalized, or linked to identifiable people.
Top comments (0)