Filtering & Examples
This guide covers common use cases for querying the Autocomplete API, including filtering by attributes and handling specific data types.
Basic Principles
- Endpoint:
https://live.luigisbox.com/autocomplete/v2 - Method:
GET - Authentication: None required (public endpoint).
Common Scenarios
1. Multi-type Search
Retrieve Products, Categories, and Queries in a single request. This is the standard "Autocomplete" behavior.
Request:
GET /autocomplete/v2?q=ukulele&type=item:6,category:3,query:3
Breakdown:
-
type: Requests 6 items, 3 categories, and 3 suggested queries.
2. Filtering by Attribute (f_type)
You can filter results for a specific type using the f_<type_name>[] parameter.
Scenario: Show only "Ukulele Straps" within the product results.
Request:
GET /autocomplete/v2?q=ukulele&type=item:6&f_item[]=category:Ukulele+Straps
Syntax Rules:
- Key-Value:
field:value(e.g.,color:green) - Ranges:
price:10|50(Price between 10 and 50). Open ranges:price:10|(10 and up). - OR Logic: Multiple filters for the same field act as OR.
-
f_item[]=color:green&f_item[]=color:blue-> Green OR Blue.
-
3. Sorting (sort_type)
Control the order of results for a specific type.
Scenario: Sort items by price (ascending).
Request:
GET /autocomplete/v2?q=ukulele&type=item:6&sort_item=price_amount:asc
4. Contextual Search
Limit results to a specific context, such as a warehouse or language version.
Request:
GET /autocomplete/v2?q=iphone&type=item:10&ctx[]=warehouse:central
See Multi-warehouse solution for more details.