---
title: Best practices
description: Guidelines for optimal performance and relevance when integrating Luigi's Box Search.
slug: search/guides/best-practices
docKind: guide
hub: search
---

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

## Always filter by main type

**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`

## 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`

## Limit payload size (`hit_fields`)

**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`

## Use pagination efficiently

**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](/search/api/v2/search/) in the reference.

## Be careful with explicit sorting

**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.

:::danger
Explicit sorting also affects `quicksearch_types`. Since secondary results are inferred from the top hits, sorting by price might push relevant brands/categories out of the "quicksearch" scope.
:::

## Use dynamic facets

**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.
