Skip to main content

Search System

Twigz provides powerful search capabilities for products, stores, and content discovery.

Search Types

  • Full-text search across product names and descriptions
  • Category-based filtering
  • Price range filtering
  • Store-specific search
  • Search by store name and description
  • Location-based search
  • Category filtering
  • Rating and review filtering
  • Fast autocomplete suggestions
  • Recent search history
  • Popular searches
  • Typo tolerance
  • Multiple filters and criteria
  • Boolean search operators
  • Faceted search
  • Sorting options

Search Implementation

// Search products
const results = await convex.query(api.shared.search.search, {
  query: "coffee beans",
  filters: {
    category: "food",
    priceRange: { min: 10, max: 50 }
  }
});
// Get search suggestions
const suggestions = await convex.query(api.shared.search.quickSearch, {
  query: "cof",
  limit: 5
});
// Complex search with multiple criteria
const results = await convex.query(api.shared.search.advancedSearch, {
  query: "organic coffee",
  filters: {
    category: "food",
    storeId: "store_123",
    priceRange: { min: 15, max: 100 },
    rating: { min: 4.0 }
  },
  sortBy: "price",
  sortOrder: "asc"
});

Search Features

Search History

  • Track user search queries
  • Personalized recommendations
  • Search analytics

Search Analytics

  • Popular search terms
  • Search success rates
  • User behavior insights

Search Optimization

  • Indexing for fast retrieval
  • Relevance scoring
  • Search result ranking

Search API Functions

FunctionDescription
searchMain search function with filters
quickSearchFast autocomplete suggestions
advancedSearchComplex search with multiple criteria
saveSearchHistorySave user search queries
getSearchHistoryRetrieve user search history
clearSearchHistoryClear user search history

Best Practices

  1. Indexing: Ensure all searchable content is properly indexed
  2. Performance: Use pagination for large result sets
  3. Relevance: Implement proper relevance scoring
  4. User Experience: Provide clear search feedback
  5. Analytics: Track search performance and user behavior
The search system is optimized for fast, relevant results with support for complex filtering and sorting.