{"slug": "property-management-support-retrieval-architecture-setting-query-limits-for-pdf", "title": "Property Management Support Retrieval Architecture — Setting Query Limits for PDF Answers", "summary": "A developer outlined a bounded retrieval architecture for property-management support knowledge bases, arguing that RAG pipelines should enforce explicit query limits — maximum vector candidates, reranked passages, context tokens, and a retrieval deadline — kept in configuration so tests exercise the same constraints as production. The design enforces candidate limits in the adapter and token limits before generation, emitting reasons like candidate_limit or deadline with query and source IDs rather than silently truncating. The writeup warns that duplicate or superseded policy PDFs can produce conflicting answers, and recommends logging source IDs, rejecting superseded material, and escalating to human review when effective dates are missing.", "body_md": "Short answer: for a customer-support knowledge base, use a retrieval architecture with hard, observable query limits, then spend that budget on the smallest set of PDF passages that can answer a property manager's question. A bounded retriever is easier to debug and cheaper to operate than a search call that keeps expanding until a prompt looks full.\n\nThe data flow is straightforward: extract text from lease guides, maintenance policies, and resident notices; split it into passages with source and page metadata; retrieve candidates for the incoming question; and give only an authorized, bounded context to the generator. Retrieval-Augmented Generation (RAG) joins a retriever with a generator, so the answer can use evidence outside the generator's fixed training data. The boundary between those stages is where query limits belong.\n\nI care about this boundary because a support corpus grows quietly. One month it is 400 PDFs; six months later it is years of policy revisions, duplicate move-in packets, and scanned addenda. A larger top-k feels safe until latency, token use, and irrelevant passages become the actual incident.\n\nTreat a query limit as a contract, not a single integer. Define a maximum number of vector candidates, a maximum number of reranked passages, a maximum context-token allowance, and a deadline for the complete retrieval stage. Keep the values in configuration so a test can exercise the same limits as production.\n\nHere is a small TypeScript shape for that contract. It does not depend on a particular search product; the adapter can call a local index or an HTTP service.\n\n```\ntype QueryBudget = {\n  candidateLimit: number;\n  passageLimit: number;\n  contextTokens: number;\n  deadlineMs: number;\n};\n\ntype SupportQuery = {\n  text: string;\n  propertyId: string;\n  budget: QueryBudget;\n};\n\ntype Passage = {\n  text: string;\n  sourceId: string;\n  page: number;\n  score: number;\n};\n\ninterface Retriever {\n  retrieve(query: SupportQuery, signal: AbortSignal): Promise<Passage[]>;\n}\n\nexport async function boundedContext(\n  retriever: Retriever,\n  query: SupportQuery,\n): Promise<Passage[]> {\n  const controller = new AbortController();\n  const timer = setTimeout(() => controller.abort(), query.budget.deadlineMs);\n\n  try {\n    const candidates = await retriever.retrieve(query, controller.signal);\n    return candidates\n      .filter((passage) => passage.text.length > 0)\n      .sort((a, b) => b.score - a.score)\n      .slice(0, query.budget.passageLimit);\n  } finally {\n    clearTimeout(timer);\n  }\n}\n```\n\nThe adapter should enforce `candidateLimit` before it returns, and the caller should enforce the context-token limit before generation. Those are separate controls: a reranker may need more candidates than the final prompt can hold. If a limit is reached, emit a reason such as `candidate_limit` or `deadline`, along with the query ID and source IDs. A silent truncation makes a bad answer look like a model problem.\n\nOne sentence matters here. Fail closed.\n\nKeep receipts.\n\nThe first failure is usually duplicate evidence. Property policies are copied into every building's folder, then revised without removing the old file. A broad nearest-neighbor search returns three versions of the same rule. The generator sees conflicting move-out windows and picks a fluent one. More context did not add certainty; it added competing authority.\n\nThat conflict deserves a concrete trace. Imagine a 2024 lease addendum saying residents receive 30 days' notice and a later PDF changing the rule to 60 days. Both files contain the phrase “notice period,” and both can score well for the same question. If ingestion did not record an effective date, retrieval cannot know which passage governs. I would log both source IDs, reject superseded material during filtering, and require the answer to cite the surviving page. If the dates are missing, the honest result is an escalation for a human review, not a confident blend of two paragraphs. This is a data-contract problem before it is a ranking problem, and raising candidate limits only makes the trace noisier.\n\nThe second failure is a limit mismatch. A vector stage returns 50 passages, a reranker keeps 20, and the prompt builder quietly clips at an undocumented character count. Operators then tune the wrong number. Log counts at each stage: candidates received, passages retained, tokens admitted, and sources cited. The RAG paper's basic retrieve-then-generate pattern is useful precisely because these stages can be measured independently.\n\nThe third failure is authorization leakage. A tenant or property identifier must constrain the candidate set before ranking, not after the answer is drafted. Carry `propertyId`, document status, effective date, and source page as metadata. If the policy for Building A is retrieved for Building B, the correct behavior is exclusion and an audit event, not a prompt instruction asking the model to ignore it.\n\nI once started with a generous top-k because missing a maintenance exception felt worse than paying for extra context. The later review showed that stale PDFs, not low recall, were driving the disagreements. Your mileage may vary, but the diagnostic order is stable: inspect source freshness and stage counts before raising limits.\n\nUse a small test set of real question shapes: “Is a late fee waived during a repair?” “Who approves an emergency vendor?” and “What notice period applies to this property?” Include questions whose answer is absent, duplicated, or split across pages. Measure retrieval recall against an adjudicated passage, answer citation accuracy, p95 retrieval latency, and context tokens. Do not combine those into one score; a fast answer with the wrong page is still wrong.\n\n| Control | What it protects | Cost of setting it too low | \n|---|---|---|\n| Candidate limit | Search latency and reranker work | The supporting passage never reaches ranking | \n| Passage limit | Prompt size and conflicting evidence | Multi-step policy answers lose a needed clause | \n| Context-token limit | Generation latency and token spend | Context is clipped without a clear reason | \n| Deadline | User-facing response time | A slow but relevant retrieval is abandoned | \n\nKeep the limits asymmetric. A short factual question can use a tight passage limit, while a policy question spanning eligibility and exceptions may need more candidates but still fit the same context budget. Route by query class only after measuring those classes; hard-coded “simple versus complex” labels become another source of drift.\n\nThe catch is that a bounded architecture is not suitable when your support team cannot maintain source metadata or adjudicate representative questions. In that case, adding a reranker or a larger index will mask governance debt. Fix document ownership and effective dates first, or keep a smaller manually curated FAQ until the corpus is ready.\n\nStart with one property and a narrow PDF slice. Record the source ID and page at ingestion, then run the same fixture through candidate retrieval, reranking, and context assembly. Add a deleted document, a superseded policy, a cross-property near-duplicate, and an unanswerable question. The expected result for each case should be explicit: cited answer, refusal to guess, or no authorized passage.\n\nNext, replay the fixture under progressively tighter budgets. Plot latency and citation accuracy separately. A limit change is a code change, so review it, version it, and keep the old setting available for rollback. Watch for sudden jumps in empty retrievals, deadline cancellations, and repeated source IDs; those signals tell you whether the problem is indexing, filtering, or budget pressure.\n\nMeasure the boundary.\n\nThe practical decision rule is modest: choose the smallest limits that preserve adjudicated evidence for each query class, and make every truncation visible. That keeps a property manager's answer grounded without turning the knowledge base into an unbounded prompt cache.", "url": "https://wpnews.pro/news/property-management-support-retrieval-architecture-setting-query-limits-for-pdf", "canonical_source": "https://dev.to/adalbertcross4085/property-management-support-retrieval-architecture-setting-query-limits-for-pdf-answers-13ge", "published_at": "2026-11-19 04:31:47+00:00", "updated_at": "2026-11-19 04:41:53.110562+00:00", "lang": "en", "topics": ["artificial-intelligence", "large-language-models", "ai-agents", "ai-tools"], "entities": [], "also_reported_by": [], "takeaway": "Enforce a query budget of candidate limit, passage limit, context tokens and a retrieval deadline in configuration, and log a reason such as candidate_limit or deadline with query and source IDs instead of silently truncating.", "recommendation": {"advice": "Set explicit candidate, passage, context-token and deadline limits in config shared with tests, and reject superseded PDFs by effective date or escalate to human review when dates are missing.", "playbook": "rag-retrieval", "playbook_url": "https://wpnews.pro/playbooks/rag-retrieval"}, "alternates": {"html": "https://wpnews.pro/news/property-management-support-retrieval-architecture-setting-query-limits-for-pdf", "markdown": "https://wpnews.pro/news/property-management-support-retrieval-architecture-setting-query-limits-for-pdf.md", "text": "https://wpnews.pro/news/property-management-support-retrieval-architecture-setting-query-limits-for-pdf.txt", "jsonld": "https://wpnews.pro/news/property-management-support-retrieval-architecture-setting-query-limits-for-pdf.jsonld"}}