references/ai-search/patterns.md
AI Search Pattern Routes
Choose retrieval-only search when your application displays chunks or handles generation itself; choose chat completions when AI Search should also generate the answer. Read Search Workers binding for both paths and streaming behavior.
| Task | Documentation | |------|---------------| | Isolate tenants using separate instances or a shared filtered instance | Multitenancy | | Define built-in or custom metadata | Metadata attributes | | Filter by metadata, combine conditions, or match a folder and subfolders | Filtering | | Tune result count and relevance thresholds | Result controls | | Resolve follow-up queries using conversation context | Query rewriting | | Improve result ordering with a second model | Reranking | | Customize generation and query-rewriting instructions | System prompt |
For tenant isolation, read the full multitenancy guide before choosing an approach. A lower-bound folder comparison alone does not establish a tenant boundary; use the documented filtering semantics.