info:
  name: Search Media Items
  type: http
  seq: 2

http:
  method: GET
  url: "{{base_url}}/api/media-items/search?q=harry"
  headers:
    - name: ""
      value: application/json
  auth: inherit

settings:
  encodeUrl: true
  timeout: 0
  followRedirects: true
  maxRedirects: 5

docs: |-
  ## Search Media Items
    
    Performs a search across all visible media items using partial matching with fuzzy fallback.
    
    **Method:** GET
    
    **Endpoint:** /api/media-items/search
    
    **Authentication:** Required (Bearer token)
    
    **Query Parameters:**
    - `q` (string, required): Search query (minimum 2 characters)
    
    **Search Behavior:**
    1. First performs case-insensitive partial matching across:
       - Title
       - Author
       - Series
       - Tags
       - Contributors
    2. If no results found, falls back to fuzzy search using word_similarity with 0.3 threshold
    
    **Response:** Array of media item objects (same structure as List Media Items)
    
    **Status Codes:**
    - 200: Success (results found)
    - 404: No results found
    - 400: Missing or invalid query parameter
    - 401: Unauthorized
    - 500: Internal server error
    
    **Examples:**
    - Search by title: `q=harry potter`
    - Search by author: `q=king`
    - Fuzzy search: `q=hary poter` (will find "harry potter")
    
    **Ranking:**
    Results are ranked by relevance:
    - Title matches: Highest priority
    - Author matches: High priority
    - Series matches: Medium priority
    - Tag matches: Lower priority
    - Fuzzy matches: Sorted by similarity score
