Appearance
Search & Discovery ​
File Information ​
- Path:
app/pages/[brand_name]/search.vue,app/composables/core/pages/useSearch.ts - Purpose: Comprehensive search system with Typesense integration
Overview ​
The Search System provides comprehensive search functionality with Typesense integration. It supports full-text search, advanced filtering (tags, file types, dates), pagination, sorting, bulk actions, and URL-based search state management with encryption.
Architecture ​
System Components ​
- Search Bar: Header search bar with suggestions and results dropdown
- Search Filter: Advanced filter panel with multiple filter types
- Search Results: Display results with grid/list view modes
- Search API: Typesense integration for high-performance search
- URL State Management: Encrypted query parameters for deep linking
Key Features ​
1. Full-Text Search ​
- Search query input with Typesense integration
- Search suggestions
- Encrypted URL state management
- Real-time search results
- Wildcard search support
2. Advanced Filters ​
- Tag Filters: Infinite scroll pagination for tags
- File Type Filters: Paginated file type selection
- Date Range Filters: Date-added and last-modified-date filters
- Custom Field Filters: Workspace-specific custom fields
- Filter Persistence: Filters stored in encrypted URL
- Filter Removal: Easy filter removal with chips
3. Search Results ​
- Grid and list view modes
- Sortable columns (Name, Date Modified, Date Added, File Size, File Type)
- Infinite scroll pagination
- Bulk selection and actions
- Results count display
4. Bulk Actions ​
- Download selected assets
- Share selected assets
- Remove selection
- Selection count display
5. URL State Management ​
- Encrypted query parameters
- Filter state in URL
- Deep linking support
- Browser back/forward support
- Shareable search URLs
File Structure ​
Core Files ​
Vue Page Files (.vue) ​
app/pages/[brand_name]/search.vue- Main search page- Search interface
- Filter management
- Results display
- Bulk actions
Route: /{brand_name}/search
Composables ​
app/composables/core/pages/useSearch.ts- Search page composable- Search execution
- Filter management
- Result pagination
- URL state management
- Sorting and view modes
app/composables/core/components/search/useSearchBar.ts- Search bar composable- Search bar state
- Search suggestions
- Search execution
app/composables/core/components/search/useSearchFilter.ts- Search filter composable- Filter state management
- Filter operations
- Filter persistence
Components ​
app/components/search/SearchBar.vue- Header search bar- Search input
- Search suggestions
- Quick filters
- Search results dropdown
app/components/search/SearchFilter.vue- Advanced filter panel- Tag filters with infinite scroll
- File type filters
- Date range filters
- Custom field filters
app/components/search/SearchAssets.vue- Search results display- Grid/list view toggle
- Asset cards
- Pagination
- Infinite scroll
app/components/search/SearchBulkActions.vue- Bulk actions toolbar- Download selected
- Share selected
- Clear selection
app/components/search/AddedFilterOption.vue- Active filter display- Filter chip display
- Remove filter action
app/components/search/SearchTableHeader.vue- Table header with sorting
Stores ​
app/stores/search.ts- Search state management- Search query
- Active filters
- Search results
- Pagination state
- Popular search data
API ​
server/api/typesense/search.post.ts- Server-side Typesense search proxyapp/composables/api/useSearchApi.ts- Search API composable
Data Flow ​
Search Execution ​
- User enters search query or applies filters
- Search state encrypted and stored in URL
- Typesense API called with query and filters
- Results processed and displayed
- Pagination handled via infinite scroll
Filter Management ​
- User opens filter panel
- Filters selected (tags, file types, dates)
- Filter list updated
- URL encrypted with new filter state
- Search executed with new filters
- Results updated
User Interactions ​
Search Input
- Enter search query
- Search triggers on filter changes
- Encrypted URL state management
Filter Management
- Add filters (tags, file types, dates)
- Remove filters
- Reset all filters
- Filter pagination with infinite scroll
Results Display
- Toggle grid/list view
- Sort by columns
- Scroll for more results
- Select assets for bulk actions
Bulk Actions
- Download selected assets
- Share selected assets
- Remove selection
URL Sharing
- Share URL with search state
- Deep linking support
- Browser back/forward support
Performance Optimizations ​
- Scroll Throttling: Uses
requestAnimationFramefor scroll events - Debouncing: Debounces load more calls (300ms)
- Pagination: Loads 48 items per page
- Lazy Loading: Tags and file types loaded with pagination
- URL State: Encrypted state prevents URL length issues
- Request Batching: Batches state updates using
nextTick
API Endpoints ​
Search Assets ​
- Endpoint:
POST /api/typesense/search(viasearchAssetsApi()) - Request: Typesense search payload with filters and sorting
- Response: Search results with pagination
Get Search Data ​
- Endpoint:
GET /search/data(viagetSearchData()) - Response: Tags and file types metadata
Related Documentation ​
- useSearch Composable - Search composable details
- Search Store - Search state management
- Typesense API - Search API endpoints
- SearchFilter Component - Filter component
- SearchAssets Component - Results component
- Typesense Integration - Typesense setup