Search API
The Search API provides advanced search capabilities including semantic (natural language), multi-modal (text + images), and visual similarity search.
Semantic Search
Section titled “Semantic Search”Search properties using natural language descriptions.
POST /api/search/semanticRequest Body
Section titled “Request Body”{ "query": "modern kitchen with granite countertops", "city": "Twin Falls", "min_price": 200000, "max_price": 500000, "limit": 20}| Field | Type | Required | Description |
|---|---|---|---|
query | string | Yes | Natural language search query |
city | string | No | Filter by city |
min_price | number | No | Minimum price filter |
max_price | number | No | Maximum price filter |
min_beds | integer | No | Minimum bedrooms |
limit | integer | No | Max results (default: 20) |
Example Request
Section titled “Example Request”curl -X POST \ -H "Content-Type: application/json" \ -d '{ "query": "family home with large backyard near schools", "city": "Twin Falls", "min_beds": 3 }' \ https://api.your-domain.com/api/search/semanticResponse
Section titled “Response”{ "query": "family home with large backyard near schools", "results": [ { "listing_id": "202412345", "list_price": 375000, "address": "456 Oak Lane", "city": "Twin Falls", "beds": 4, "baths": 2.5, "similarity": 0.89, "matched_text": "...spacious backyard perfect for families..." } ], "total": 15, "search_type": "semantic"}The similarity score ranges from 0 to 1, with higher scores indicating better matches.
Multi-Modal Search
Section titled “Multi-Modal Search”Combine text search with image description matching for richer results.
POST /api/search/multimodalRequest Body
Section titled “Request Body”{ "query": "open concept living room with vaulted ceilings", "include_images": true, "limit": 20}Response
Section titled “Response”{ "query": "open concept living room with vaulted ceilings", "results": [ { "listing_id": "202412345", "list_price": 425000, "text_similarity": 0.82, "image_similarity": 0.91, "combined_score": 0.87, "matching_images": [ { "url": "https://photos.mlsgrid.com/living-room.jpg", "description": "Spacious living room with 20-foot vaulted ceilings", "similarity": 0.91 } ] } ], "search_type": "multimodal"}Compare Search Methods
Section titled “Compare Search Methods”Run a search against all methods to compare results.
POST /api/search/compareRequest Body
Section titled “Request Body”{ "query": "modern kitchen with island"}Response
Section titled “Response”{ "query": "modern kitchen with island", "methods": { "semantic": { "results": [...], "count": 15, "avg_similarity": 0.76 }, "image_description": { "results": [...], "count": 12, "avg_similarity": 0.81 }, "visual_embedding": { "results": [...], "count": 10, "avg_similarity": 0.73 } }, "recommendation": "image_description"}Image Search
Section titled “Image Search”Search by Description
Section titled “Search by Description”Find images based on automatically generated descriptions.
GET /api/admin/search/images?q=granite+countertops| Parameter | Type | Description |
|---|---|---|
q | string | Search query (min 2 chars) |
limit | integer | Max results (default: 20, max: 50) |
Response
Section titled “Response”{ "query": "granite countertops", "results": [ { "image_id": 123, "listing_id": "202412345", "image_url": "https://photos.mlsgrid.com/kitchen.jpg", "image_index": 2, "description": "Modern kitchen featuring dark granite countertops...", "room_type": "kitchen", "similarity": 0.88 } ], "total": 45, "search_type": "image_description"}Visual Similarity Search
Section titled “Visual Similarity Search”Find images that look similar using SigLIP embeddings.
GET /api/admin/search/images-visual?q=modern+white+kitchenFind Similar Images
Section titled “Find Similar Images”Find photos similar to a specific property photo.
POST /api/search/similar-imagesRequest Body
Section titled “Request Body”{ "image_url": "https://photos.mlsgrid.com/kitchen.jpg", "limit": 10}Autocomplete
Section titled “Autocomplete”Get search suggestions as the user types.
GET /api/search/autocomplete?q=twin| Parameter | Type | Description |
|---|---|---|
q | string | Partial search query |
limit | integer | Max suggestions (default: 10) |
Response
Section titled “Response”{ "suggestions": [ {"text": "Twin Falls", "type": "city", "count": 156}, {"text": "Twin Falls County", "type": "county", "count": 245}, {"text": "twin home", "type": "property_type", "count": 23} ]}Image Indexing (Admin)
Section titled “Image Indexing (Admin)”Get Index Statistics
Section titled “Get Index Statistics”GET /api/admin/embeddings/images/statsResponse
Section titled “Response”{ "total_properties": 1250, "properties_with_images": 1180, "total_images": 7500, "description_embeddings": 6800, "visual_embeddings": 5200}Trigger Reindex
Section titled “Trigger Reindex”POST /api/admin/embeddings/reindex/images?limit=10| Parameter | Type | Description |
|---|---|---|
limit | integer | Max properties to process (1-100) |
background | boolean | Run as background task |
Related
Section titled “Related”- Effective Search Queries — How to write better queries
- Search Quality Scores — Understanding similarity scores
- Properties API — Property search endpoints