Skip to content

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

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",
    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));
See something that needs updating? Suggest an edit