Skip to main content

Overview

The Search API provides powerful search capabilities across all marketplace entities including stores, products, and customers. It supports real-time search, advanced filtering, search history, and intelligent autocomplete functionality. Location: convex/shared/search.ts

Search Types

Quick Search

Fast autocomplete search with limited results for instant feedback

Comprehensive Search

Full search with pagination, filtering, and sorting options

Advanced Search

Complex search with multiple filters, price ranges, and location-based filtering

Search History

Save and retrieve user search history for better UX
Performs fast search with limited results, perfect for autocomplete functionality.
query
string
required
Search query string
limit
number
Maximum results to return (default: 10)
Performs full search with pagination and detailed results.
query
string
required
Search query string
type
'all' | 'customers' | 'stores' | 'products'
Filter by entity type (default: “all”)
categoryId
Id<'categories'>
Optional category filter applied to stores/products
paginationOpts
PaginationOptions
required
Pagination configuration with numItems and cursor
Performs complex search with multiple filters and sorting options.
query
string
required
Search query string
filters
object
Advanced filter options:
paginationOpts
PaginationOptions
required
Pagination configuration

Save Search History

Save a user’s search query to their search history.
searchTerm
string
required
Search query text
searchType
'all' | 'customers' | 'stores' | 'products'
required
Search type that was used
resultCount
number
required
Number of results returned for this search

Get Search History

Retrieve user’s search history.
limit
number
Maximum number of history entries to return (default: 20)

Clear Search History

Clear all search history for the authenticated user.

Get Friends List

Get all mutual friends (customers who follow each other bidirectionally).
paginationOpts
PaginationOptions
required
Pagination configuration

Search Friends Only

Search among mutual friends (customers who follow each other bidirectionally).
query
string
required
Search query to find among mutual friends
paginationOpts
PaginationOptions
required
Pagination configuration

Get Share Recipients

Get recent and frequent share recipients based on the user’s sharing history.
limit
number
Maximum number of recipients to return per category (default: 20)
Test search functionality with sample results (development/debugging).
query
string
required
Search query to test
type
'all' | 'customers' | 'stores' | 'products'
Search type filter

Search Component Examples

Complete search implementations for your frontend:

Search Features

Real-time Results

Instant search results as users type with debounced queries

Search History

Save and display user search history for better UX

Advanced Filters

Filter by category, location, price range, and more

Smart Sorting

Sort by relevance, price, rating, date, or alphabetically

Error Handling

Status Code: 400
Status Code: 400
Status Code: 503
Search results are automatically indexed and updated in real-time as data changes. The search system supports fuzzy matching and handles typos gracefully.
Use quick search for autocomplete functionality and comprehensive search for full search pages. Save frequently searched terms to improve user experience.