- Move search-related requests into bruno/media-items/search/ subdirectory - Rename Fuzzy Genre Filter.yml to Fuzzy Tags Filter.yml - Keep scenario-based requests in bruno/media-items/scenarios/ - Improve collection organization and discoverability This reorganization makes the Bruno API collection more organized by grouping search endpoints together and updating genre filter to tags filter.
90 lines
2.3 KiB
YAML
90 lines
2.3 KiB
YAML
info:
|
|
name: Field Values Search - Genres
|
|
type: http
|
|
seq: 7
|
|
|
|
http:
|
|
method: GET
|
|
url: "{{base_url}}/api/media-items/search?library_id={{library_id}}&tags=sci&limit=50"
|
|
params:
|
|
- name: library_id
|
|
value: "{{library_id}}"
|
|
type: query
|
|
- name: tags
|
|
value: sci
|
|
type: query
|
|
- name: limit
|
|
value: "50"
|
|
type: query
|
|
auth: inherit
|
|
|
|
settings:
|
|
encodeUrl: true
|
|
timeout: 0
|
|
followRedirects: true
|
|
maxRedirects: 5
|
|
|
|
docs: |-
|
|
## Field Values Search - Genres
|
|
|
|
Fetches distinct tags values for autocomplete dropdowns with counts and similarity scores.
|
|
|
|
**Method:** GET
|
|
|
|
**Endpoint:** /api/media-items/search
|
|
|
|
**Authentication:** Required (Bearer token)
|
|
|
|
**Query Parameters:**
|
|
- `library_id` (string, required): Library UUID to search within
|
|
- `tags` (string, required): Genre name to search for (fuzzy match)
|
|
- `limit` (integer, optional): Maximum results to return (default: 50)
|
|
|
|
**How It Works:**
|
|
- Returns distinct tags names from the library
|
|
- Fuzzy matches the search query against tags names
|
|
- Includes count of books per tags
|
|
- Includes similarity score (0-1, higher = better match)
|
|
- Sorted by similarity score, then by count
|
|
|
|
**Use Case:**
|
|
- Populate autocomplete dropdown when user types in tags filter field
|
|
- Show user available tagss with book counts
|
|
- Help users discover similar tags names
|
|
|
|
**Response:** HTTP 200 (OK)
|
|
```json
|
|
{
|
|
"results": [
|
|
{
|
|
"value": "Sci-Fi",
|
|
"count": 234,
|
|
"score": 0.85
|
|
},
|
|
{
|
|
"value": "Science Fiction",
|
|
"count": 156,
|
|
"score": 0.82
|
|
}
|
|
],
|
|
"total": 2
|
|
}
|
|
```
|
|
|
|
**Examples:**
|
|
- `tags=sci` → Returns "Sci-Fi" (234 books), "Science Fiction" (156 books)
|
|
- `tags=fant` → Returns "Fantasy" (345 books), "High Fantasy" (89 books)
|
|
- `tags=mystery` → Returns "Mystery" (123 books), "Mystery/Thriller" (45 books)
|
|
|
|
**Frontend Integration:**
|
|
- Call this endpoint when user types ≥2 characters in tags field
|
|
- Display results in `<datalist>` or custom dropdown
|
|
- Show: "Genre Name (count)" format
|
|
- Allow user to select from suggestions
|
|
|
|
**Success Criteria:**
|
|
- Status: 200
|
|
- Returns array of tags values with counts
|
|
- Results sorted by relevance (similarity score)
|
|
- Only returns tagss matching the fuzzy search
|