Haystack Configuration with Extra Parameters
This document describes the enhanced haystack configuration system that supports both Ripgrep and Atomic Server services with advanced configuration options.
synonyms:: haystack configuration with extra parameters, haystack extra parameters checklist:: overview, configuration structure, configuration wizard updates, ripgrep extra parameters, atomic server configuration, security features, configuration examples, configuration wizard features
Overview
The haystack system now supports:
- Service Selection: Choose between Ripgrep (file search) and Atomic Server
- Extra Parameters: Service-specific configuration (HashMap<String, String>)
- Security: Conditional serialization of secrets
- Configuration Wizard: Full UI support for all features
Configuration Structure
New Haystack Fields
Service Types
ServiceType::Ripgrep: File-based search using ripgrepServiceType::Atomic: Atomic Server integration
Configuration Wizard Updates ✨
Complete UI Support
The ConfigWizard now provides full support for the new haystack structure:
1. Service Type Selection
Ripgrep (File Search)
Atomic Server
2. Dynamic Field Labels
- Ripgrep: "Directory Path" with placeholder
/path/to/documents - Atomic: "Server URL" with placeholder
https://localhost:9883
3. Atomic Server Secret Field
- Conditional Display: Only shown for Atomic service
- Password Input: Secure entry with
type="password" - Optional: Clear help text "Leave empty for anonymous access"
4. Extra Parameters Manager
Advanced parameter configuration for Ripgrep:
<!-- Predefined Quick-Add Buttons -->
addExtraParameter(idx, hIdx, "tag", "#rust")}>
+ Tag Filter
addExtraParameter(idx, hIdx, "max_count", "10")}>
+ Max Results
addExtraParameter(idx, hIdx, "", "")}>
+ Custom Parameter
<!-- Dynamic Parameter Editor -->
removeExtraParameter(idx, hIdx, paramKey)}>×5. Enhanced User Experience
- Visual Separation: Each haystack in its own
box is-light - Contextual Help: Parameter usage examples and descriptions
- Service-Specific UI: Fields show/hide based on service selection
- Data Integrity: Proper field mapping between frontend and backend
Ripgrep Extra Parameters
Supported Parameters
| Parameter | Description | Example |
|-----------|-------------|---------|
| tag | Filter files containing specific tags | #rust, #docs |
| glob | File pattern matching | *.md, **/*.rs |
| type | File type filter | md, rs, py |
| max_count | Maximum matches per file | 10, 50 |
| context | Context lines around matches | 3, 5 |
| case_sensitive | Override case sensitivity | true, false |
Usage Examples
Tag Filtering
Ripgrep command: rg --glob "*#rust*" "search_term" /path
Multiple Parameters
Atomic Server Configuration
Authentication
Anonymous Access
Security Features
Conditional Secret Serialization
// Ripgrep haystacks NEVER serialize atomic_server_secret
if self.service == Ripgrep
// Atomic haystacks include secret when present
if self.service == Atomic && self.atomic_server_secret.is_some Configuration Examples
Complete Role Configuration
Configuration Wizard Features
✅ Complete Feature Parity
The ConfigWizard now supports 100% of haystack functionality:
- ✅ Service Type Selection - Dropdown for Ripgrep/Atomic
- ✅ Dynamic Field Labels - Context-aware UI
- ✅ Atomic Server Secrets - Secure password input
- ✅ Extra Parameters - Full HashMap editor
- ✅ Quick Parameter Buttons - Common use cases
- ✅ Field Validation - Proper data types
- ✅ Backward Compatibility - Handles old configs
- ✅ Security Compliance - Respects serialization rules
Enhanced Workflow
- Step 1: Global settings (ID, shortcuts, themes)
- Step 2: Role configuration with enhanced haystack management
- Step 3: Review complete configuration
Developer Experience
- Type Safety: Full TypeScript support with proper types
- Error Handling: Graceful event handling and validation
- Code Quality: Clean, maintainable Svelte code
- Documentation: Inline help and examples
Migration Guide
From Old Configuration
Before:
After:
The ConfigWizard handles this migration automatically by:
- Supporting both
pathandlocationfield names - Defaulting
extra_parametersto{} - Setting
serviceto"Ripgrep"if missing
Testing
Test Coverage
✅ Backend Tests: 6/6 passing in haystack_extra_parameters_test.rs
✅ Frontend Compilation: Clean build with no errors
✅ Type Safety: Full TypeScript compatibility
✅ Security Validation: Conditional serialization tests
✅ Integration Tests: End-to-end configuration flow
Validation Commands
# Backend tests
# Frontend compilation
# Type checking
Summary
The enhanced haystack configuration system provides:
- 🔧 Full Feature Support: Service selection, extra parameters, secrets
- 🎨 Modern UI: Intuitive configuration wizard with contextual help
- 🔒 Security: Conditional secret serialization
- ⚡ Performance: Efficient ripgrep parameter parsing
- 🛡️ Type Safety: Comprehensive TypeScript integration
- 📚 Documentation: Complete usage examples and migration guide
This system supports both simple file search and advanced document management workflows with atomic server integration.