Overview
The Advanced Search API provides powerful filtering capabilities for searching housing listings based on tags (amenities) and star ratings. This endpoint enables users to find accommodations that match their specific requirements.This endpoint does not require authentication and is publicly accessible for searching available housing.
Search Houses
Search for housing listings with optional filters for tags and minimum star rating.Query Parameters
Comma-separated list of tags to filter by (e.g., ‘beach,pool,wifi’). Tag names are case-insensitive and will be trimmed of whitespace.Example values:
beachpool,wifibeach,pool,gym,spa
Minimum star rating to filter by (1-5). Only houses with this rating or higher will be returned.Valid values: 1, 2, 3, 4, 5
Both parameters are optional. If neither is provided, all houses will be returned.
Response
Array of HousingDTO objects matching the search criteria
Example Response - Search by Tags
Example Response - Search by Tags
Example Response - Search by Stars
Example Response - Search by Stars
Status Codes
| Code | Description |
|---|---|
| 200 | Successfully retrieved filtered houses |
| 500 | Internal server error |
Search Examples
Find Beachfront Hotels
Search for all hotels with beach access:Find Luxury Hotels (4+ Stars)
Search for high-end accommodations:Find Luxury Beachfront Hotels with Pool
Combine multiple filters for specific requirements:Find Budget Hotels with WiFi
Search for affordable options with internet access:Available Tags
Common tags used in the Trippins platform for filtering:beach
Beach access or beachfront location
pool
Swimming pool facility
wifi
WiFi internet access
parking
Parking facilities
gym
Fitness center or gym
spa
Spa and wellness facilities
restaurant
On-site restaurant
bar
Bar or lounge
pets
Pet-friendly accommodation
breakfast
Breakfast included
airport
Airport shuttle service
balcony
Private balcony or terrace
Search Logic
Tag Filtering
The tag filter uses an OR logic by default:- Houses matching any of the specified tags will be returned
- Tags are processed as lowercase and trimmed
- Empty or null tag parameter returns all houses
Star Rating Filtering
The star filter uses a minimum threshold:- Only houses with stars >= specified value are returned
- Valid values are 1-5
Combined Filters
When both filters are applied, houses must satisfy both conditions:- Must have at least one of the specified tags AND
- Must meet the minimum star rating
Implementation Details
The search endpoint is implemented in theAdvancedSearchRestController class:
Endpoint: GET /v1/api/query
Processing Steps:
- Parse the comma-separated tags string
- Convert tags to lowercase and trim whitespace
- Query the database using
HousingService.findHousesByTagsAndStars() - Return matching houses as JSON
- Controller:
/controller/AdvancedSearchRestController.java:74-100 - Service method:
HousingService.findHousesByTagsAndStars(Set<String> tags, Integer stars)
Pagination Support
For paginated housing results, use the AJAX endpoints:Get Paginated Houses
This endpoint returns paginated accepted houses and is useful for infinite scroll implementations.
Page number (0-based, default: 0)
Number of items per page (default: 6)
Error Handling
Error Response Format
Error type (e.g., “Search failed”)
Detailed error message describing what went wrong
Example Error Response
Example Error Response
Common Errors
| Scenario | Status Code | Error Message |
|---|---|---|
| Database connection failure | 500 | ”Search failed - Database error” |
| Invalid star value (< 1 or > 5) | 500 | ”Invalid star rating. Must be between 1 and 5.” |
| Malformed request | 400 | ”Bad Request - Invalid parameters” |
Performance Tips
Use Cases
Filter by Amenities
Allow users to find hotels with specific features like pools, gyms, or beach access
Quality Filtering
Enable users to filter by minimum star rating for quality assurance
Vacation Planner
Help users find perfect vacation spots with desired amenities
Business Travel
Find accommodations with business-friendly amenities like WiFi and parking
Related Endpoints
- Get All Houses - Retrieve complete housing list
- Get House by ID - Get detailed information about a specific house
- Housing Tags - View available tags for a house
