Skip to content

Filters and facets

View MD

Learn about the filtering capabilities of Luigi’s Box Search, from simple key-value pairs to complex boolean logic.

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)

As shown above, simply repeating the f[] parameter for the same field creates an OR condition.

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.

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

See the Search API reference for the complete payload structure and examples.

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 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:

  1. Initial query: yamaha

    • Facets returned:
      • Condition: new (822), used (1)
      • Category: guitars (423), pianos (400)
  2. 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.

For catalogs with many attributes, manually selecting which facets to display is inefficient. Use the dynamic_facets_size parameter to let the 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.