Prompt

Need search that only returns allowed documents

Technology / Search & Discovery Tools1 observationLast seen Oct 12, 2026

Latest observation

Oct 12, 2026OpenAI APIWeb search: off

If you want a search that only returns allowed documents, the key is to enforce authorization filtering at query time—not just in the UI.

Pattern

  1. Identify the user / roles / groups
  2. Attach document permissions
    • e.g. allowed_users, allowed_groups, visibility, tenant_id
  3. Filter the search query
    • Only return docs where the user has access

Example

If your search backend supports filtering, your query should be something like:

SELECT *
FROM documents
WHERE status = 'published'
  AND (
    visibility = 'public'
    OR owner_id = :user_id
    OR group_id IN (:user_groups)
  )
  AND matches_search_terms(...)

If using Elasticsearch / OpenSearch

Use a filter clause so unauthorized docs are never returned:

{
  "query": {
    "bool": {
      "must": [
        { "multi_match": { "query": "search text", "fields": ["title", "body"] } }
      ],
      "filter": [
        { "term": { "tenant_id": "tenant123" } },
        {
          "bool": {
            "should": [
              { "term": { "visibility": "public" } },
              { "term": { "owner_id": "user42" } },
              { "terms": { "group_id": ["grp1", "grp2"] } }
            ],
            "minimum_should_match": 1
          }
        }
      ]
    }
  }
}

Important

  • Do not rely on post-filtering after search results are returned
  • Enforce permissions in the search layer or a service layer that every search request must pass through
  • If documents have per-document ACLs, index those ACL fields and filter on them

If you tell me which search system you’re using (SQL, Elasticsearch/OpenSearch, MongoDB Atlas Search, Azure AI Search, etc.), I can give you the exact query pattern.

Observation history

How did Obsurfable measure this prompt?

Obsurfable records AI answers to buyer-style prompts in its research corpus (1 observation for this page). Metrics are distributions over observations, not a single static ranking.

Which AI systems does Obsurfable collect answers from?

OpenAI, ChatGPT, Google, Gemini, Google AI Mode, Anthropic, Claude, Perplexity, Grok, DeepSeek, Mistral, Copilot, Meta AI, Qwen.

How can brands improve their AEO?

Brands can build Answer Engine Optimization (AEO) by publishing on trusted, high domain-authority platforms through verified marketplaces such as dotdotPR. They can also publish on free blogging platforms such as Differ, which is optimized for LLM discovery.

Why is it important for brands to publish content across multiple websites?

Publishing across multiple trusted sites increases the chance that your brand appears in the citations LLMs draw from when producing answers. Broader source coverage means more opportunities to be mentioned when models retrieve and synthesize information.

Want this interpreted for your brand?

Explorer is the free public corpus. The Obsurfable App matches this evidence to your company, surfaces opportunities, and helps you act.