Overview
The Search System provides global site search with advanced filter support using key:value syntax. It queries a GraphQL endpoint for posts and pages, with client-side filtering for fine-grained control. Source:~/workspace/source/shared/components/search/search-system.js
Key Features
GraphQL Integration
Queries WordPress GraphQL endpoint for posts and pages
Advanced Filtering
Supports key:value filters (type:, category:, tag:, author:, after:, before:)
Query Parser
Parses complex search queries with filters and exclusions
Recent Searches
Stores and displays recent searches in localStorage
Configuration
Filter Syntax
The search system supports advanced key:value filter syntax:- Content Type
- Category
- Date Range
- Exclusions
Query Parser
The system uses the QueryParser module to extract filters from search queries:Local Filtering
When GraphQL doesn’t support specific filters, the system applies them client-side:GraphQL Query
The search system queries WordPress posts and pages:User Interface
Opening Search
Search Overlay HTML
Debouncing
The system debounces search input to avoid excessive API calls:- Search delay: 300ms
- Filter delay: 150ms (faster for real-time feedback)
Recent Searches
Recent searches are stored in localStorage and displayed when the search overlay opens:Filter Chips
Active filters are displayed as removable chips above search results:Usage Examples
Basic Search
Filtered Search
Date Range
Exclusions
Best Practices
Combine text and filters
Combine text and filters
Use plain text search combined with filters for best results:
branding type:portfolio category:identityUse client-side filtering strategically
Use client-side filtering strategically
GraphQL provides initial filtering. Use local filtering for refinements that GraphQL doesn’t support.
Test filter combinations
Test filter combinations
Not all filter combinations make sense. Test edge cases like
type:page category:blog.Provide filter examples
Provide filter examples
Show users example queries in the search placeholder or help text.
Related Components
Query Parser
Parses search queries and extracts filters
Navigation System
Integrates search overlay with navigation

