Search
Overview
Smart Search is Rebuy's AI-powered search solution that replaces or enhances your store's native search. It provides instant search results with intelligent ranking, typo tolerance, and faceted filtering.
Key Features
- Instant Results - Search-as-you-type with sub-second response times
- AI Ranking - Results ordered by relevance and conversion likelihood
- Quick View - Dropdown search results with product previews
- Results Page - Full-page search with filters, sorting, and pagination
- Faceted Navigation - Filter by price, vendor, tags, availability, and more
Components
| Component |
Description |
| Quick View |
Dropdown overlay triggered from search input |
| Results Page |
Full search results page with sidebar filters |
Quick Start
Listen for Smart Search events to integrate custom functionality:
// Quick View ready
document.addEventListener('rebuy:smartsearch.quickview.ready', (event) => {
console.log('Quick View search ready');
});
// Product added from search
document.addEventListener('rebuy:smartsearch.quickview.add', (event) => {
const { product } = event.detail;
console.log('Product added from search:', product.title);
});
// Results Page ready
document.addEventListener('rebuy:smartsearch.resultsPage.ready', (event) => {
console.log('Results Page ready');
});
See Smart Search Event Listeners for all available events.
Search API
POST /api/v1/smart-search/search
Returns a list of products based on the given POST parameters. Applies all of your Smart Search settings to the results.
| Response Header |
Description |
| Search-Page-Current |
The current page number of products based on your search term |
| Search-Page-Total |
The total number of pages of products based on your your search term |
| Search-Size-Current |
The number of products in the current page based on your search term |
| Search-Size-Total |
The total number of products across all pages based on your search term. |
Rebuy-Api-Key · string · required
- Your Rebuy public API key
Body Parameters
searchTerm · string · required
- Any search term present in the product name, description, SKU, variant SKUs, product handle, vendor name, or product attributes. You can also pass an empty search string to retrieve all search results from the merchant
searchContent · boolean
- When set to
true, includes content results (articles, blogs) alongside product results. Content results are returned in a separate content array in the response. Defaults to false
fields · array of strings
- The set of product fields/attributes to be returned in the search results. If omitted, all fields will be returned
promotedIds · array of strings
- Product IDs to be appended to the search results. These promoted search results will have
is_promoted field set
filters · object
- Specifies the filtering criteria for a query or a data retrieval request
filters.tags · array of strings
- A list of product tags used to further refine the search
filters.categories · array of strings
- A list of product categories used to further refine the search
filters.vendors · array of strings
- A list of product vendors used to further refine the search
filters.options · array of strings
- A list of product options used to further refine the search
filters.available · boolean
- Limit search to only available products if true
filters.price · object
- Specifies the desired price range with
min and max properties
filters.collections · array of strings
- A list of product collection IDs used to further refine the search
filters.metafields · array of strings
- A list of metafields categorized by type, namespace, name and value delimited by period characters
exclusions · object
- Defines the object that excludes the search results associated with the values supplied
exclusions.product_ids · array of strings
- List of product IDs to be excluded from the search results
exclusions.collections · array of objects
- List of collection IDs to be excluded from the search results
exclusions.tags · array of strings
- List of product tags to be excluded from the search results
sortBy · object
- Custom sort object to sort search results based on custom sort options
sortBy.field · string
- The field to sort by:
id, handle, sku, name, vendor, price, compare_at_price, visible, can_purchase, created_at, updated_at, product_type, ratings, best-sellers
sortBy.order · string
- Sort order:
ASC or DESC
boostByFields · array of objects
- Array to enhance search results by boosting certain fields based on specific criteria
aggregate · object
- Defines dimensions for data aggregation
aggregate.fields · array of strings
- Fields to aggregate:
tags, categories, vendors, options, availability, price
pageSize · integer
- The number of search results to be returned per page. Maximum value: 100
currentPage · integer
- The current page number of search results to be retrieved
responseCustomization · object
- Customization options for the response, including rating metafields
Response Fields
When searchContent is set to true, the response includes a content array containing matching articles and blog posts.
content · array of objects
Each content object contains the following fields:
| Field |
Type |
Description |
id |
string |
The unique identifier for the content |
type |
string |
The content type (e.g., article) |
title |
string |
The title of the article or blog post |
handle |
string |
The URL-friendly handle for the content |
blogTitle |
string |
The name of the blog the article belongs to |
tags |
array of strings |
Tags associated with the content |
publishedAt |
string |
The publish date in ISO 8601 format |
score |
number |
The relevance score for the content result |
The pageInfo object in the response also includes:
| Field |
Type |
Description |
contentServerSize |
integer |
The total number of content results matching the search term |
Code Example
fetch("https://rebuyengine.com/api/v1/smart-search/search", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Rebuy-Api-Key": "YOUR_API_KEY"
},
body: JSON.stringify({
searchTerm: "hat",
searchContent: true,
fields: ["product_id", "name", "price", "tags", "can_purchase", "images"],
sortBy: { field: "price", order: "ASC" },
pageSize: 15,
currentPage: 1,
filters: {
price: { min: 0, max: 10000 }
},
aggregate: {
fields: ["availability", "tags", "categories", "price"]
}
})
})
.then(response => response.json())
.then(data => console.log(data));
---
title: Search
excerpt: AI-powered product search with instant results, filters, and faceted navigation
api:
file: rebuy-smart-search.json
operationId: smart-search
deprecated: false
hidden: false
metadata:
title: ''
description: ''
robots: index
next:
description: ''
---
## Overview
Smart Search is Rebuy's AI-powered search solution that replaces or enhances your store's native search. It provides instant search results with intelligent ranking, typo tolerance, and faceted filtering.
### Key Features
- **Instant Results** - Search-as-you-type with sub-second response times
- **AI Ranking** - Results ordered by relevance and conversion likelihood
- **Quick View** - Dropdown search results with product previews
- **Results Page** - Full-page search with filters, sorting, and pagination
- **Faceted Navigation** - Filter by price, vendor, tags, availability, and more
### Components
| Component | Description |
|-----------|-------------|
| Quick View | Dropdown overlay triggered from search input |
| Results Page | Full search results page with sidebar filters |
## Quick Start
Listen for Smart Search events to integrate custom functionality:
```javascript
// Quick View ready
document.addEventListener('rebuy:smartsearch.quickview.ready', (event) => {
console.log('Quick View search ready');
});
// Product added from search
document.addEventListener('rebuy:smartsearch.quickview.add', (event) => {
const { product } = event.detail;
console.log('Product added from search:', product.title);
});
// Results Page ready
document.addEventListener('rebuy:smartsearch.resultsPage.ready', (event) => {
console.log('Results Page ready');
});
```
See [Smart Search Event Listeners](./smart-search-event-listeners.md) for all available events.
---
## Search API
### POST /api/v1/smart-search/search
Returns a list of products based on the given POST parameters. Applies all of your Smart Search settings to the results.
## Response Headers
| Response Header | Description |
| ------------------- | ------------------------------------------------------------------------ |
| Search-Page-Current | The current page number of products based on your search term |
| Search-Page-Total | The total number of pages of products based on your your search term |
| Search-Size-Current | The number of products in the current page based on your search term |
| Search-Size-Total | The total number of products across all pages based on your search term. |
## Headers
`Rebuy-Api-Key` · string · required
: Your Rebuy public API key
## Body Parameters
`searchTerm` · string · required
: Any search term present in the product name, description, SKU, variant SKUs, product handle, vendor name, or product attributes. You can also pass an empty search string to retrieve all search results from the merchant
`searchContent` · boolean
: When set to `true`, includes content results (articles, blogs) alongside product results. Content results are returned in a separate `content` array in the response. Defaults to `false`
`fields` · array of strings
: The set of product fields/attributes to be returned in the search results. If omitted, all fields will be returned
`promotedIds` · array of strings
: Product IDs to be appended to the search results. These promoted search results will have `is_promoted` field set
`filters` · object
: Specifies the filtering criteria for a query or a data retrieval request
`filters.tags` · array of strings
: A list of product tags used to further refine the search
`filters.categories` · array of strings
: A list of product categories used to further refine the search
`filters.vendors` · array of strings
: A list of product vendors used to further refine the search
`filters.options` · array of strings
: A list of product options used to further refine the search
`filters.available` · boolean
: Limit search to only available products if true
`filters.price` · object
: Specifies the desired price range with `min` and `max` properties
`filters.collections` · array of strings
: A list of product collection IDs used to further refine the search
`filters.metafields` · array of strings
: A list of metafields categorized by type, namespace, name and value delimited by period characters
`exclusions` · object
: Defines the object that excludes the search results associated with the values supplied
`exclusions.product_ids` · array of strings
: List of product IDs to be excluded from the search results
`exclusions.collections` · array of objects
: List of collection IDs to be excluded from the search results
`exclusions.tags` · array of strings
: List of product tags to be excluded from the search results
`sortBy` · object
: Custom sort object to sort search results based on custom sort options
`sortBy.field` · string
: The field to sort by: `id`, `handle`, `sku`, `name`, `vendor`, `price`, `compare_at_price`, `visible`, `can_purchase`, `created_at`, `updated_at`, `product_type`, `ratings`, `best-sellers`
`sortBy.order` · string
: Sort order: `ASC` or `DESC`
`boostByFields` · array of objects
: Array to enhance search results by boosting certain fields based on specific criteria
`aggregate` · object
: Defines dimensions for data aggregation
`aggregate.fields` · array of strings
: Fields to aggregate: `tags`, `categories`, `vendors`, `options`, `availability`, `price`
`pageSize` · integer
: The number of search results to be returned per page. Maximum value: 100
`currentPage` · integer
: The current page number of search results to be retrieved
`responseCustomization` · object
: Customization options for the response, including rating metafields
## Response Fields
When `searchContent` is set to `true`, the response includes a `content` array containing matching articles and blog posts.
### content · array of objects
Each content object contains the following fields:
| Field | Type | Description |
|-------|------|-------------|
| `id` | string | The unique identifier for the content |
| `type` | string | The content type (e.g., `article`) |
| `title` | string | The title of the article or blog post |
| `handle` | string | The URL-friendly handle for the content |
| `blogTitle` | string | The name of the blog the article belongs to |
| `tags` | array of strings | Tags associated with the content |
| `publishedAt` | string | The publish date in ISO 8601 format |
| `score` | number | The relevance score for the content result |
The `pageInfo` object in the response also includes:
| Field | Type | Description |
|-------|------|-------------|
| `contentServerSize` | integer | The total number of content results matching the search term |
## Code Example
```javascript
fetch("https://rebuyengine.com/api/v1/smart-search/search", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Rebuy-Api-Key": "YOUR_API_KEY"
},
body: JSON.stringify({
searchTerm: "hat",
searchContent: true,
fields: ["product_id", "name", "price", "tags", "can_purchase", "images"],
sortBy: { field: "price", order: "ASC" },
pageSize: 15,
currentPage: 1,
filters: {
price: { min: 0, max: 10000 }
},
aggregate: {
fields: ["availability", "tags", "categories", "price"]
}
})
})
.then(response => response.json())
.then(data => console.log(data));
```