Skip to content

Best practices

View MD

Follow these guidelines to ensure optimal performance and relevance when integrating Luigi’s Box Search.

Do: Explicitly request the main content type you want to search.

Why: The API indexes everything (products, categories, queries). Without a filter, you’ll get mixed results.

Incorrect: q=ukulele (Returns products, brands, and categories mixed together)

Correct: q=ukulele&f[]=type:product

Section titled “Use quicksearch_types for universal search”

Do: Use quicksearch_types to fetch secondary results (e.g., matching brands or categories) in the same request as products.

Why: It reduces HTTP requests and latency.

Example request: f[]=type:product&quicksearch_types=category,brand&q=ukulele

Do: Request only the fields you need for the search results card (e.g., title, image, price, url).

Why: Default responses include all indexed attributes. Limiting fields can reduce payload size by 4x-5x, significantly improving mobile performance.

Example: hit_fields=title,image_link,price_amount,url

Do: Request a small initial size (e.g., 10-24) and load more pages as needed.

Why: Large page sizes increase server processing time and transfer time.

See pagination parameters in the reference.

Caution: Using the sort parameter overrides the AI ranking algorithms.

Consequence: When you sort by “Price Ascending”, you lose the relevance ranking. Users might see cheap accessories (pick, string) instead of the actual instrument (guitar) they searched for.

Do: Use dynamic_facets_size instead of hardcoding facets.

Why: The AI automatically selects relevant filters for each query (e.g., “Lens Type” for cameras vs. “Fabric” for shirts), providing a better UX without manual configuration.