test: update Bruno requests for tags filter

- Update Combined Search and Filters to use tags_filter
- Update Field Values Search to cover tags autocomplete
- Add fuzzy matching examples for tags
- Update search scenarios to use tags instead of genre

Updates the Bruno API test collection to use the new tags filter
instead of the genre filter, including fuzzy matching examples.

Relates to IMPLEMENTATION_TAGS_FILTER.md Phase 6
This commit is contained in:
2026-03-25 20:38:29 -04:00
parent 69a24a0d74
commit dc0d037e06
5 changed files with 41 additions and 41 deletions
@@ -5,7 +5,7 @@ info:
http: http:
method: GET method: GET
url: "{{base_url}}/api/media-items/search?library_id={{library_id}}&q=foundation&author_filter=asimov&genre_filter=scifi&year_min=1950&year_max=2000&sort=title ASC" url: "{{base_url}}/api/media-items/search?library_id={{library_id}}&q=foundation&author_filter=asimov&tags_filter=scifi&year_min=1950&year_max=2000&sort=title ASC"
params: params:
- name: library_id - name: library_id
value: "{{library_id}}" value: "{{library_id}}"
@@ -16,7 +16,7 @@ http:
- name: author_filter - name: author_filter
value: asimov value: asimov
type: query type: query
- name: genre_filter - name: tags_filter
value: scifi value: scifi
type: query type: query
- name: year_min - name: year_min
@@ -51,7 +51,7 @@ docs: |-
- `library_id` (string, required): Library UUID to search within - `library_id` (string, required): Library UUID to search within
- `q` (string, required): Search query for title/author/series/tags (fuzzy match) - `q` (string, required): Search query for title/author/series/tags (fuzzy match)
- `author_filter` (string, optional): Fuzzy match author field - `author_filter` (string, optional): Fuzzy match author field
- `genre_filter` (string, optional): Fuzzy match genre field - `tags_filter` (string, optional): Fuzzy match tags field
- `year_min` (integer, optional): Minimum copyright year (exact match) - `year_min` (integer, optional): Minimum copyright year (exact match)
- `year_max` (integer, optional): Maximum copyright year (exact match) - `year_max` (integer, optional): Maximum copyright year (exact match)
- `sort` (string, optional): Sort order (e.g., "title ASC", "author DESC", "created_at DESC") - `sort` (string, optional): Sort order (e.g., "title ASC", "author DESC", "created_at DESC")
@@ -59,7 +59,7 @@ docs: |-
**How Combined Search Works:** **How Combined Search Works:**
- All filters are AND'd together (must match ALL conditions) - All filters are AND'd together (must match ALL conditions)
- Search query (`q`) uses fuzzy matching across title, author, series, tags - Search query (`q`) uses fuzzy matching across title, author, series, tags
- Text filters (author, genre) use fuzzy matching - Text filters (author, tags) use fuzzy matching
- Year filters use exact range matching - Year filters use exact range matching
- Results sorted by relevance first, then by sort parameter - Results sorted by relevance first, then by sort parameter
@@ -70,7 +70,7 @@ docs: |-
"id": "uuid", "id": "uuid",
"title": "Foundation", "title": "Foundation",
"author": "Asimov, Isaac", "author": "Asimov, Isaac",
"genre": "Sci-Fi", "tags": "Sci-Fi",
"copyright_year": 1951, "copyright_year": 1951,
"library_id": "uuid", "library_id": "uuid",
"library_name": "E-Books" "library_name": "E-Books"
@@ -79,8 +79,8 @@ docs: |-
``` ```
**Example Use Cases:** **Example Use Cases:**
- Find "Foundation" by "Asimov" in "Sci-Fi" genre from 1950-2000 - Find "Foundation" by "Asimov" in "Sci-Fi" tags from 1950-2000
- Search "potter" with genre "fantasy" published after 2000 - Search "potter" with tags "fantasy" published after 2000
- Find "mars" books by "sci-fi" authors sorted by date - Find "mars" books by "sci-fi" authors sorted by date
**Success Criteria:** **Success Criteria:**
@@ -5,12 +5,12 @@ info:
http: http:
method: GET method: GET
url: "{{base_url}}/api/media-items/search?library_id={{library_id}}&genre=sci&limit=50" url: "{{base_url}}/api/media-items/search?library_id={{library_id}}&tags=sci&limit=50"
params: params:
- name: library_id - name: library_id
value: "{{library_id}}" value: "{{library_id}}"
type: query type: query
- name: genre - name: tags
value: sci value: sci
type: query type: query
- name: limit - name: limit
@@ -27,7 +27,7 @@ settings:
docs: |- docs: |-
## Field Values Search - Genres ## Field Values Search - Genres
Fetches distinct genre values for autocomplete dropdowns with counts and similarity scores. Fetches distinct tags values for autocomplete dropdowns with counts and similarity scores.
**Method:** GET **Method:** GET
@@ -37,20 +37,20 @@ docs: |-
**Query Parameters:** **Query Parameters:**
- `library_id` (string, required): Library UUID to search within - `library_id` (string, required): Library UUID to search within
- `genre` (string, required): Genre name to search for (fuzzy match) - `tags` (string, required): Genre name to search for (fuzzy match)
- `limit` (integer, optional): Maximum results to return (default: 50) - `limit` (integer, optional): Maximum results to return (default: 50)
**How It Works:** **How It Works:**
- Returns distinct genre names from the library - Returns distinct tags names from the library
- Fuzzy matches the search query against genre names - Fuzzy matches the search query against tags names
- Includes count of books per genre - Includes count of books per tags
- Includes similarity score (0-1, higher = better match) - Includes similarity score (0-1, higher = better match)
- Sorted by similarity score, then by count - Sorted by similarity score, then by count
**Use Case:** **Use Case:**
- Populate autocomplete dropdown when user types in genre filter field - Populate autocomplete dropdown when user types in tags filter field
- Show user available genres with book counts - Show user available tagss with book counts
- Help users discover similar genre names - Help users discover similar tags names
**Response:** HTTP 200 (OK) **Response:** HTTP 200 (OK)
```json ```json
@@ -72,18 +72,18 @@ docs: |-
``` ```
**Examples:** **Examples:**
- `genre=sci` → Returns "Sci-Fi" (234 books), "Science Fiction" (156 books) - `tags=sci` → Returns "Sci-Fi" (234 books), "Science Fiction" (156 books)
- `genre=fant` → Returns "Fantasy" (345 books), "High Fantasy" (89 books) - `tags=fant` → Returns "Fantasy" (345 books), "High Fantasy" (89 books)
- `genre=mystery` → Returns "Mystery" (123 books), "Mystery/Thriller" (45 books) - `tags=mystery` → Returns "Mystery" (123 books), "Mystery/Thriller" (45 books)
**Frontend Integration:** **Frontend Integration:**
- Call this endpoint when user types ≥2 characters in genre field - Call this endpoint when user types ≥2 characters in tags field
- Display results in `<datalist>` or custom dropdown - Display results in `<datalist>` or custom dropdown
- Show: "Genre Name (count)" format - Show: "Genre Name (count)" format
- Allow user to select from suggestions - Allow user to select from suggestions
**Success Criteria:** **Success Criteria:**
- Status: 200 - Status: 200
- Returns array of genre values with counts - Returns array of tags values with counts
- Results sorted by relevance (similarity score) - Results sorted by relevance (similarity score)
- Only returns genres matching the fuzzy search - Only returns tagss matching the fuzzy search
+9 -9
View File
@@ -5,12 +5,12 @@ info:
http: http:
method: GET method: GET
url: "{{base_url}}/api/media-items/search?library_id={{library_id}}&genre_filter=scifi" url: "{{base_url}}/api/media-items/search?library_id={{library_id}}&tags_filter=scifi"
params: params:
- name: library_id - name: library_id
value: "{{library_id}}" value: "{{library_id}}"
type: query type: query
- name: genre_filter - name: tags_filter
value: scifi value: scifi
type: query type: query
auth: inherit auth: inherit
@@ -24,7 +24,7 @@ settings:
docs: |- docs: |-
## Fuzzy Genre Filter ## Fuzzy Genre Filter
Filters media items by genre using fuzzy matching (tolerates typos and variations). Filters media items by tags using fuzzy matching (tolerates typos and variations).
**Method:** GET **Method:** GET
@@ -34,7 +34,7 @@ docs: |-
**Query Parameters:** **Query Parameters:**
- `library_id` (string, required): Library UUID to search within - `library_id` (string, required): Library UUID to search within
- `genre_filter` (string, required): Genre to fuzzy match (e.g., "scifi" matches "Sci-Fi", "Science Fiction") - `tags_filter` (string, required): Genre to fuzzy match (e.g., "scifi" matches "Sci-Fi", "Science Fiction")
**How Fuzzy Matching Works:** **How Fuzzy Matching Works:**
- Uses PostgreSQL pg_trgm word_similarity() - Uses PostgreSQL pg_trgm word_similarity()
@@ -50,7 +50,7 @@ docs: |-
"id": "uuid", "id": "uuid",
"title": "Foundation", "title": "Foundation",
"author": "Asimov, Isaac", "author": "Asimov, Isaac",
"genre": "Sci-Fi", "tags": "Sci-Fi",
"library_id": "uuid", "library_id": "uuid",
"library_name": "E-Books" "library_name": "E-Books"
} }
@@ -58,11 +58,11 @@ docs: |-
``` ```
**Examples:** **Examples:**
- `genre_filter=scifi` → Matches "Sci-Fi", "Science Fiction" - `tags_filter=scifi` → Matches "Sci-Fi", "Science Fiction"
- `genre_filter=fantasy` → Matches "Fantasy", "High Fantasy" - `tags_filter=fantasy` → Matches "Fantasy", "High Fantasy"
- `genre_filter=mystery` → Matches "Mystery", "Mystery/Thriller" - `tags_filter=mystery` → Matches "Mystery", "Mystery/Thriller"
**Success Criteria:** **Success Criteria:**
- Status: 200 - Status: 200
- Returns items with genres similar to the filter - Returns items with tagss similar to the filter
- Results sorted by similarity score - Results sorted by similarity score
+7 -7
View File
@@ -21,7 +21,7 @@ http:
value: "" value: ""
type: query type: query
disabled: true disabled: true
- name: genre_filter - name: tags_filter
value: "" value: ""
type: query type: query
disabled: true disabled: true
@@ -88,8 +88,8 @@ docs: |-
- `series_filter` (string, optional): Fuzzy match series field - `series_filter` (string, optional): Fuzzy match series field
- Example: `series_filter=harry` matches "Harry Potter" - Example: `series_filter=harry` matches "Harry Potter"
- `genre_filter` (string, optional): Fuzzy match genre field - `tags_filter` (string, optional): Fuzzy match tags field
- Example: `genre_filter=scifi` matches "Sci-Fi", "Science Fiction" - Example: `tags_filter=scifi` matches "Sci-Fi", "Science Fiction"
- `language_filter` (string, optional): Fuzzy match language field - `language_filter` (string, optional): Fuzzy match language field
- Example: `language_filter=eng` matches "English", "eng" - Example: `language_filter=eng` matches "English", "eng"
@@ -125,7 +125,7 @@ docs: |-
## How Fuzzy Matching Works ## How Fuzzy Matching Works
**Text Filters (author, series, genre, language):** **Text Filters (author, series, tags, language):**
- Uses PostgreSQL pg_trgm word_similarity() - Uses PostgreSQL pg_trgm word_similarity()
- Threshold: 0.3 (30% similarity) - Threshold: 0.3 (30% similarity)
- Handles typos: "azimov" → "Asimov" - Handles typos: "azimov" → "Asimov"
@@ -148,7 +148,7 @@ docs: |-
"title": "Foundation", "title": "Foundation",
"author": "Asimov, Isaac", "author": "Asimov, Isaac",
"series": "Foundation", "series": "Foundation",
"genre": "Sci-Fi", "tags": "Sci-Fi",
"language": "English", "language": "English",
"copyright_year": 1951, "copyright_year": 1951,
"page_count": 255, "page_count": 255,
@@ -185,9 +185,9 @@ docs: |-
**3. Combined search + filters:** **3. Combined search + filters:**
``` ```
GET /api/media-items/search?q=foundation&author_filter=asimov&genre_filter=scifi&library_id={uuid} GET /api/media-items/search?q=foundation&author_filter=asimov&tags_filter=scifi&library_id={uuid}
``` ```
Returns "foundation" books by "asimov" in "scifi" genre Returns "foundation" books by "asimov" in "scifi" tags
**4. Exact match with quotes:** **4. Exact match with quotes:**
``` ```
@@ -39,8 +39,8 @@ docs: |-
- `copyright_year DESC` - Newest copyright first - `copyright_year DESC` - Newest copyright first
- `page_count ASC` - Shortest first - `page_count ASC` - Shortest first
- `page_count DESC` - Longest first - `page_count DESC` - Longest first
- `genre ASC` - Genre A-Z - `tags ASC` - Genre A-Z
- `genre DESC` - Genre Z-A - `tags DESC` - Genre Z-A
- `limit` (integer, optional): Number of items to return (default: 50, max: 1000) - `limit` (integer, optional): Number of items to return (default: 50, max: 1000)
- `offset` (integer, optional): Number of items to skip (default: 0) - `offset` (integer, optional): Number of items to skip (default: 0)