> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dados.rio/llms.txt
> Use this file to discover all available pages before exploring further.

# Busca documento por ID em qualquer coleção configurada (v2)

> Retorna documento de qualquer coleção configurada. Se 'collection' fornecido como query param, tenta buscar nessa coleção primeiro. Caso contrário, busca em todas as coleções configuradas.



## OpenAPI

````yaml https://raw.githubusercontent.com/prefeitura-rio/app-busca-search/refs/heads/main/docs/openapi-v3.json get /api/v2/search/{id}
openapi: 3.0.0
info:
  description: >-
    API para busca textual e vetorial usando Typesense e embeddings gerados via
    Google Gemini
  title: Mecanismo de Busca API
  termsOfService: http://swagger.io/terms/
  contact:
    name: Prefeitura do Rio de Janeiro
    url: https://prefeitura.rio
    email: contato@prefeitura.rio
  license:
    name: Apache 2.0
    url: http://www.apache.org/licenses/LICENSE-2.0.html
  version: '1.0'
servers:
  - url: https://services.pref.rio/app-busca-search
    description: Production server
  - url: https://services.staging.app.dados.rio/app-busca-search
    description: Staging server
security: []
paths:
  /api/v2/search/{id}:
    get:
      tags:
        - search-v2
      summary: Busca documento por ID em qualquer coleção configurada (v2)
      description: >-
        Retorna documento de qualquer coleção configurada. Se 'collection'
        fornecido como query param, tenta buscar nessa coleção primeiro. Caso
        contrário, busca em todas as coleções configuradas.
      parameters:
        - example: cffe0736-80a6-46fe-ace6-3cebb4d262ea
          description: ID do documento (UUID)
          name: id
          in: path
          required: true
          schema:
            type: string
        - example: go-cursos
          description: Collection hint para busca otimizada
          name: collection
          in: query
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/models.UnifiedDocument'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                type: object
                additionalProperties:
                  type: string
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                type: object
                additionalProperties:
                  type: string
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                type: object
                additionalProperties:
                  type: string
      security:
        - bearerAuth: []
components:
  schemas:
    models.UnifiedDocument:
      type: object
      properties:
        collection:
          description: Which collection this document belongs to
          type: string
        data:
          description: Raw document data from Typesense
          type: object
          additionalProperties: true
        id:
          type: string
        score_info:
          $ref: '#/components/schemas/models.ScoreInfo'
        type:
          description: Document type from collection config (service, course, job, etc.)
          type: string
    models.ScoreInfo:
      type: object
      properties:
        final_score:
          description: Score final após aplicar recency boost
          type: number
        hybrid_score:
          description: Score híbrido combinado 0-1
          type: number
        passed_threshold:
          description: Se passou no threshold
          type: boolean
        recency_factor:
          description: Fator de recência aplicado (1.0 = recente, decai com o tempo)
          type: number
        text_match_normalized:
          description: Score normalizado 0-1 do text_match
          type: number
        threshold_applied:
          description: 'Tipo de threshold aplicado: "keyword", "semantic", "hybrid", "none"'
          type: string
        threshold_value:
          description: Valor do threshold aplicado
          type: number
        vector_similarity:
          description: Similaridade vetorial 0-1 (1 = idêntico)
          type: number
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````