Filters and Facets
Learn about the filtering capabilities of Luigi's Box Search, from simple key-value pairs to complex boolean logic.
Basic Filtering
To filter search results, use the f[] parameter. This parameter accepts key-value pairs (field:value).
Example:
f[]=category:jackets
Logic:
- Filters of the same type (same field) are combined with OR.
- Filters of different types (different fields) are combined with AND.
Example Request:
f[]=category:jackets&f[]=category:windproof&f[]=brand:Adidas
Interpretation:
(Category is jackets OR windproof) AND (Brand is Adidas)
Boolean Logic
OR Logic (Default)
As shown above, simply repeating the f[] parameter for the same field creates an OR condition.
AND Logic (f_must[])
To force an AND condition between filters of the same type, use the f_must[] parameter.
Example:
Find products that are in both jackets AND windproof categories.
f_must[]=category:jackets&f_must[]=category:windproof
See the f_must[] parameter reference for more details.
Complex Logic (Nested AND/OR/NOT)
For advanced scenarios requiring nested logic (e.g., "(A OR B) AND (C OR D) AND NOT E"), use the POST method instead of GET. You define the logic in a JSON payload.
Method: POST
URL: https://live.luigisbox.com/search
Payload:
See the Search API Reference for the complete payload structure and examples.
Complex filters are strict: they limit the scope of all facets, unlike standard filters which often allow "multi-select" behavior in facets.
Handling Missing Values
By default, filtering by a field excludes items where that field is missing. To include them, use the special value value_missing.
Example:
Get items where color is red OR color is missing (undefined).
f[]=color:red&f[]=color:value_missing
This works for numeric, date, boolean, and text filters.
Facets
Facets provide the "filters" typically seen in the sidebar of a search result page. The API returns the available counts for each facet value based on the current query.
Example Flow:
-
Initial Query:
yamaha- Facets Returned:
-
Condition:new (822),used (1) -
Category:guitars (423),pianos (400)
-
- Facets Returned:
-
User Filters:
Condition: used- Result:
- Condition Facet: Still shows
new (822),used (1)(so the user can uncheck or switch). - Category Facet: Updates to
guitars (1). Pianos are removed because no used pianos match the query.
- Condition Facet: Still shows
- Result:
Dynamic Facets
For catalogs with many attributes, manually selecting which facets to display is inefficient. Use the dynamic_facets_size parameter to let our AI Model automatically select the most relevant facets for the specific query (e.g., showing "Bridge Type" for guitars but "Number of Keys" for pianos).
See dynamic_facets_size in the reference.