Files
bookhoard/bruno/media-items/scenarios/Search Media Items.yml
T
john-okeefe f859b2714d refactor(bruno): reorganize file structure from bruno-yaml to flat bruno directory
- Move all files from bruno-yaml/* to bruno/*
- Maintains existing directory structure within categories
- Updates bruno/user/auth files with OAuth2 refresh token flow
- Updates bruno/user/profile files for user profile management
- Adds bruno/dashboard/ directory with dashboard API tests
- Preserves all existing test scenarios and OpenCollection YAML format
- No functional changes - file reorganization only
2026-02-17 20:22:21 -05:00

63 lines
1.7 KiB
YAML

info:
name: Search Media Items
type: http
seq: 1
http:
method: GET
url: '{{base_url}}/api/media-items/search?q=harry'
auth: inherit
headers:
- key: Content-Type
value: application/json
runtime:
scripts:
- type: tests
code: "test_search_media_items_success(status, headers, body) {\n if (status\
\ !== 200 && status !== 404) {\n throw new Error(\"Expected status 200\
\ or 404, got \" + status);"
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