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:
@@ -5,7 +5,7 @@ info:
|
||||
|
||||
http:
|
||||
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:
|
||||
- name: library_id
|
||||
value: "{{library_id}}"
|
||||
@@ -16,7 +16,7 @@ http:
|
||||
- name: author_filter
|
||||
value: asimov
|
||||
type: query
|
||||
- name: genre_filter
|
||||
- name: tags_filter
|
||||
value: scifi
|
||||
type: query
|
||||
- name: year_min
|
||||
@@ -51,7 +51,7 @@ docs: |-
|
||||
- `library_id` (string, required): Library UUID to search within
|
||||
- `q` (string, required): Search query for title/author/series/tags (fuzzy match)
|
||||
- `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_max` (integer, optional): Maximum copyright year (exact match)
|
||||
- `sort` (string, optional): Sort order (e.g., "title ASC", "author DESC", "created_at DESC")
|
||||
@@ -59,7 +59,7 @@ docs: |-
|
||||
**How Combined Search Works:**
|
||||
- All filters are AND'd together (must match ALL conditions)
|
||||
- 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
|
||||
- Results sorted by relevance first, then by sort parameter
|
||||
|
||||
@@ -70,7 +70,7 @@ docs: |-
|
||||
"id": "uuid",
|
||||
"title": "Foundation",
|
||||
"author": "Asimov, Isaac",
|
||||
"genre": "Sci-Fi",
|
||||
"tags": "Sci-Fi",
|
||||
"copyright_year": 1951,
|
||||
"library_id": "uuid",
|
||||
"library_name": "E-Books"
|
||||
@@ -79,8 +79,8 @@ docs: |-
|
||||
```
|
||||
|
||||
**Example Use Cases:**
|
||||
- Find "Foundation" by "Asimov" in "Sci-Fi" genre from 1950-2000
|
||||
- Search "potter" with genre "fantasy" published after 2000
|
||||
- Find "Foundation" by "Asimov" in "Sci-Fi" tags from 1950-2000
|
||||
- Search "potter" with tags "fantasy" published after 2000
|
||||
- Find "mars" books by "sci-fi" authors sorted by date
|
||||
|
||||
**Success Criteria:**
|
||||
|
||||
@@ -5,12 +5,12 @@ info:
|
||||
|
||||
http:
|
||||
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:
|
||||
- name: library_id
|
||||
value: "{{library_id}}"
|
||||
type: query
|
||||
- name: genre
|
||||
- name: tags
|
||||
value: sci
|
||||
type: query
|
||||
- name: limit
|
||||
@@ -27,7 +27,7 @@ settings:
|
||||
docs: |-
|
||||
## 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
|
||||
|
||||
@@ -37,20 +37,20 @@ docs: |-
|
||||
|
||||
**Query Parameters:**
|
||||
- `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)
|
||||
|
||||
**How It Works:**
|
||||
- Returns distinct genre names from the library
|
||||
- Fuzzy matches the search query against genre names
|
||||
- Includes count of books per genre
|
||||
- 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 genre filter field
|
||||
- Show user available genres with book counts
|
||||
- Help users discover similar genre names
|
||||
- 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
|
||||
@@ -72,18 +72,18 @@ docs: |-
|
||||
```
|
||||
|
||||
**Examples:**
|
||||
- `genre=sci` → Returns "Sci-Fi" (234 books), "Science Fiction" (156 books)
|
||||
- `genre=fant` → Returns "Fantasy" (345 books), "High Fantasy" (89 books)
|
||||
- `genre=mystery` → Returns "Mystery" (123 books), "Mystery/Thriller" (45 books)
|
||||
- `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 genre field
|
||||
- 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 genre values with counts
|
||||
- Returns array of tags values with counts
|
||||
- Results sorted by relevance (similarity score)
|
||||
- Only returns genres matching the fuzzy search
|
||||
- Only returns tagss matching the fuzzy search
|
||||
|
||||
@@ -5,12 +5,12 @@ info:
|
||||
|
||||
http:
|
||||
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:
|
||||
- name: library_id
|
||||
value: "{{library_id}}"
|
||||
type: query
|
||||
- name: genre_filter
|
||||
- name: tags_filter
|
||||
value: scifi
|
||||
type: query
|
||||
auth: inherit
|
||||
@@ -24,7 +24,7 @@ settings:
|
||||
docs: |-
|
||||
## 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
|
||||
|
||||
@@ -34,7 +34,7 @@ docs: |-
|
||||
|
||||
**Query Parameters:**
|
||||
- `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:**
|
||||
- Uses PostgreSQL pg_trgm word_similarity()
|
||||
@@ -50,7 +50,7 @@ docs: |-
|
||||
"id": "uuid",
|
||||
"title": "Foundation",
|
||||
"author": "Asimov, Isaac",
|
||||
"genre": "Sci-Fi",
|
||||
"tags": "Sci-Fi",
|
||||
"library_id": "uuid",
|
||||
"library_name": "E-Books"
|
||||
}
|
||||
@@ -58,11 +58,11 @@ docs: |-
|
||||
```
|
||||
|
||||
**Examples:**
|
||||
- `genre_filter=scifi` → Matches "Sci-Fi", "Science Fiction"
|
||||
- `genre_filter=fantasy` → Matches "Fantasy", "High Fantasy"
|
||||
- `genre_filter=mystery` → Matches "Mystery", "Mystery/Thriller"
|
||||
- `tags_filter=scifi` → Matches "Sci-Fi", "Science Fiction"
|
||||
- `tags_filter=fantasy` → Matches "Fantasy", "High Fantasy"
|
||||
- `tags_filter=mystery` → Matches "Mystery", "Mystery/Thriller"
|
||||
|
||||
**Success Criteria:**
|
||||
- Status: 200
|
||||
- Returns items with genres similar to the filter
|
||||
- Returns items with tagss similar to the filter
|
||||
- Results sorted by similarity score
|
||||
|
||||
@@ -21,7 +21,7 @@ http:
|
||||
value: ""
|
||||
type: query
|
||||
disabled: true
|
||||
- name: genre_filter
|
||||
- name: tags_filter
|
||||
value: ""
|
||||
type: query
|
||||
disabled: true
|
||||
@@ -88,8 +88,8 @@ docs: |-
|
||||
- `series_filter` (string, optional): Fuzzy match series field
|
||||
- Example: `series_filter=harry` matches "Harry Potter"
|
||||
|
||||
- `genre_filter` (string, optional): Fuzzy match genre field
|
||||
- Example: `genre_filter=scifi` matches "Sci-Fi", "Science Fiction"
|
||||
- `tags_filter` (string, optional): Fuzzy match tags field
|
||||
- Example: `tags_filter=scifi` matches "Sci-Fi", "Science Fiction"
|
||||
|
||||
- `language_filter` (string, optional): Fuzzy match language field
|
||||
- Example: `language_filter=eng` matches "English", "eng"
|
||||
@@ -125,7 +125,7 @@ docs: |-
|
||||
|
||||
## How Fuzzy Matching Works
|
||||
|
||||
**Text Filters (author, series, genre, language):**
|
||||
**Text Filters (author, series, tags, language):**
|
||||
- Uses PostgreSQL pg_trgm word_similarity()
|
||||
- Threshold: 0.3 (30% similarity)
|
||||
- Handles typos: "azimov" → "Asimov"
|
||||
@@ -148,7 +148,7 @@ docs: |-
|
||||
"title": "Foundation",
|
||||
"author": "Asimov, Isaac",
|
||||
"series": "Foundation",
|
||||
"genre": "Sci-Fi",
|
||||
"tags": "Sci-Fi",
|
||||
"language": "English",
|
||||
"copyright_year": 1951,
|
||||
"page_count": 255,
|
||||
@@ -185,9 +185,9 @@ docs: |-
|
||||
|
||||
**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:**
|
||||
```
|
||||
|
||||
@@ -39,8 +39,8 @@ docs: |-
|
||||
- `copyright_year DESC` - Newest copyright first
|
||||
- `page_count ASC` - Shortest first
|
||||
- `page_count DESC` - Longest first
|
||||
- `genre ASC` - Genre A-Z
|
||||
- `genre DESC` - Genre Z-A
|
||||
- `tags ASC` - Genre A-Z
|
||||
- `tags DESC` - Genre Z-A
|
||||
- `limit` (integer, optional): Number of items to return (default: 50, max: 1000)
|
||||
- `offset` (integer, optional): Number of items to skip (default: 0)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user