AACsearch
SDKsRecetario

Cookbook

Copy-paste recipes for the most common AACsearch SDK patterns — autocomplete, faceted search, product listings, click tracking, scoped tokens, multi-tenant, multi-locale, and graceful failure.

These recipes assume you have already followed Browser SDK setup and have a search-only API key (ss_search_*). All snippets are typed against @aacsearch/client (Node + browser) — adapt to other languages as needed.

Pick a recipe

RecipeWhat you get
AutocompleteDebounced search-as-you-type with a dropdown of suggestions
Faceted searchMulti-select filter sidebar driven by AACsearch facet counts
Product listing pageServer-rendered PLP with filters, sort, pagination
Infinite scrollLoad-more pagination using TanStack Query's useInfiniteQuery
Click analyticsTrack result clicks and conversions with events/track
No-results recommendationsShow fallback content when found: 0
Fallback searchDegrade gracefully when AACsearch is unreachable
Scoped B2B catalogPer-customer price tiers and product visibility via scoped tokens
Marketplace tenant isolationMulti-vendor marketplace where each storefront sees only its own SKUs
Multi-locale catalogSame products in en/de/es/fr/ru — single index with locale facet

Common setup

Every recipe assumes one of these clients:

// Browser-safe (search only)
import { SearchClient } from "@aacsearch/client";

const client = new SearchClient({
	baseUrl: process.env.NEXT_PUBLIC_AACSEARCH_BASE_URL!,
	apiKey: process.env.NEXT_PUBLIC_AACSEARCH_SEARCH_KEY!, // ss_search_*
	indexSlug: "products",
});
// Server-only (full CRUD)
import { AdminClient } from "@aacsearch/client";

const admin = new AdminClient({
	baseUrl: process.env.AACSEARCH_BASE_URL!,
	apiKey: process.env.AACSEARCH_ADMIN_KEY!, // aa_admin_*
	projectId: process.env.AACSEARCH_ORG_ID!,
});

Sample dataset assumed across recipes:

type Product = {
	id: string;
	external_id: string;
	title: string;
	description: string;
	brand: string;
	categories: string[];
	price: number; // major units, decimal
	in_stock: boolean;
	locale: "en" | "de" | "es" | "fr" | "ru";
	organization_id: string; // for multi-tenant recipes
	customer_tier?: "retail" | "wholesale" | "vip"; // B2B only
};

Every recipe is independently runnable. They share conventions (sample dataset, env var names, naming) but you can copy any one without setting up the others first.

What you will not find here

On this page