Search Feature with Algolia/Upstash
Document Information
Version: 2.0 Last Updated: 2026-01-15 Status: Active Owner: Product Team
Overview
Purpose
The Search feature enables users to quickly find clients, partners, vehicles, orders, invoices, and users within their company context, dramatically reducing time spent locating information and improving operational efficiency across the platform.
Problem Statement
Users currently spend excessive time navigating through lists and filters to locate specific entities. Manual searches through large datasets lead to:
- Lost productivity: Staff spend 15-30 minutes per day searching for information manually
- Customer service delays: Support calls extend 2-3 minutes while staff locate customer records
- Data isolation gaps: Without proper search boundaries, there’s risk of cross-company data exposure
- Scalability limits: As company data grows, current navigation methods become increasingly inefficient
Business Value
| Value Area | Measurable Outcome | Baseline | Target | Timeframe |
|---|---|---|---|---|
| Staff Productivity | Time saved per employee per day searching for records | 20 minutes/day (manual navigation) | 3 minutes/day | 3 months post-launch |
| Customer Service Speed | Average time to locate customer record during support calls | 45 seconds | Under 5 seconds | 3 months post-launch |
| Data Security | Cross-tenant data exposure incidents | 0 (required compliance) | 0 (maintain compliance) | Continuous |
| Platform Scalability | Maximum searchable entities without performance degradation | 50,000 entities | 1,000,000+ entities | 6 months post-launch |
| Infrastructure Cost | Monthly search infrastructure cost | €X (Algolia) | 40% reduction | Upon migration completion |
Success Metrics
| Metric | Definition | Baseline | Target | Measurement Method |
|---|---|---|---|---|
| Search Response Time | Time from query submission to results displayed | N/A (new feature) | <500ms (95th percentile) | Application performance monitoring |
| Search Adoption Rate | % of users utilizing search vs. manual navigation | 0% | 80%+ | User analytics (search events / active users) |
| Time to First Result | End-to-end time users spend finding specific records | 45 seconds avg | <10 seconds avg | User session analytics |
| Support Call Efficiency | Average call duration for record lookup requests | 4.5 minutes | 3 minutes | Call center analytics |
| Data Isolation Compliance | Cross-tenant search result incidents | 0 | 0 | Security audit logs, penetration testing |
| Index Freshness | Time between database change and searchable availability | N/A | <5 minutes | Monitoring dashboard |
| Search Accuracy | % of searches returning relevant results in top 5 | N/A | 95%+ | User feedback, click-through analytics |
| System Availability | Search service uptime | N/A | 99.9% | Infrastructure monitoring |
| Migration Success | % of searches successfully served by new infrastructure | 0% | 100% | Feature flag analytics |
User Stories
End Users
| Priority | User Story | Acceptance Criteria |
|---|---|---|
| P0 | As a rental manager, I want to search for clients by name, email, or phone so I can quickly access their rental history | Given I enter a client’s partial name or contact info, When I submit the search, Then matching clients appear within 500ms with relevance ranking |
| P0 | As a fleet coordinator, I want to search vehicles by plate number, VIN, or brand/model so I can locate specific vehicles | Given I search for a partial plate number or VIN, When results display, Then I see matching vehicles with typo tolerance |
| P0 | As an operations manager, I want to search orders by order number or customer name so I can track rental status | Given I enter an order number or customer name, When I search, Then relevant orders display with current status visible |
| P1 | As a financial controller, I want to search invoices by number or customer so I can manage billing efficiently | Given I search for an invoice, When results appear, Then I can identify the correct invoice and access it directly |
| P1 | As a support staff member, I want to search across multiple entity types simultaneously so I can help customers efficiently | Given I enter a general query, When I search, Then I see categorized results across clients, orders, and invoices |
| P2 | As a partner manager, I want to search partners by company name or contact info so I can manage partnerships | Given I search for a partner, When results display, Then I see matching partners with company and contact details |
Administrators
| Priority | User Story | Acceptance Criteria |
|---|---|---|
| P1 | As a system administrator, I want search data to stay synchronized automatically so users always find current information | Given an entity is created or updated, When 5 minutes pass, Then the change is reflected in search results |
| P2 | As a platform administrator, I want to search across all companies so I can provide global support | Given I have platform admin access, When I search companies, Then I see results across all tenants |
Functional Requirements
FR-1: Multi-Entity Search
Business Need: Users need to find information quickly across different data types without knowing which category to look in.
Capabilities:
- Search across clients, partners, vehicles, orders, users, and invoices from a single search box
- Filter results by entity type when needed
- Rank results by relevance to surface most likely matches first
- Support typo tolerance to handle common input errors
Acceptance Criteria:
- Users can search all entity types or filter to specific types
- Results display within 500ms for 95% of queries
- Typo tolerance handles 1-2 character mistakes
FR-2: Company Data Isolation
Business Need: Each company’s data must remain completely isolated to meet privacy requirements and build customer trust.
Capabilities:
- Search results automatically filtered to user’s company context
- Cross-company data access prevented at infrastructure level
- Deleted records excluded from results by default, with option to include
Acceptance Criteria:
- Users only see results from their own company
- No configuration or user action required for isolation
- Security audit confirms zero cross-company data leakage
FR-3: Search Result Handling
Business Need: Search must integrate seamlessly with existing workflows so users can act on results immediately.
Capabilities:
- Results link directly to entity detail pages
- Sufficient preview information to identify correct result without clicking
- Support for bulk operations on search results
Acceptance Criteria:
- One-click navigation from result to entity
- Preview shows key identifying information (name, number, status)
- Results maintain context for back-navigation
FR-4: Automated Data Synchronization
Business Need: Search results must reflect current data to prevent users from acting on outdated information.
Capabilities:
- Automatic synchronization of new and updated entities
- Scheduled full synchronization to ensure consistency
- Self-healing capability when synchronization errors occur
Acceptance Criteria:
- New entities searchable within 5 minutes of creation
- Updates reflected within 5 minutes
- Failed synchronizations retry automatically
FR-5: Platform-Wide Search (Admin Only)
Business Need: Platform administrators need to search across all companies for support and compliance purposes.
Capabilities:
- Search all companies from admin interface
- Search marketplace orders separately
- Maintain audit trail of admin searches
Acceptance Criteria:
- Admin-only access enforced
- Results clearly indicate source company
- All admin searches logged for compliance
FR-6: Migration Support
Business Need: Transition to new search infrastructure must occur without disrupting users or losing data.
Capabilities:
- Gradual rollout controlled by configuration
- Instant rollback if issues detected
- Parallel operation during transition period
Acceptance Criteria:
- Zero user-facing downtime during migration
- Feature flags enable per-entity-type migration
- Rollback completes within 1 minute
Business Rules
BR-1: Tenant Data Isolation
All searches within a company context must return only that company’s data. Cross-company searches are prohibited except for authorized platform administrators.
BR-2: Soft Delete Handling
Deleted records remain searchable only when explicitly requested. Default searches exclude deleted items to prevent confusion.
BR-3: Search Field Scope
Only designated fields are searchable per entity type. Adding new searchable fields requires coordination with data governance.
BR-4: Data Freshness
Search results must reflect database state within 5 minutes. Longer delays require user notification.
Non-Functional Requirements
Performance
- Search queries: <500ms response (95th percentile)
- Batch indexing: 10,000+ entities per minute
- Concurrent users: Support 1,000+ simultaneous searches
Scalability
- Entity capacity: 1,000,000+ documents per tenant scope
- Tenant capacity: 1,000+ tenants without degradation
Availability
- Service uptime: 99.9% availability target
- Failover: Automatic recovery within 60 seconds
Security
- Tenant isolation enforced at infrastructure level
- All search access requires authentication
- Admin searches audited for compliance
Dependencies
Internal Systems
- PostgreSQL Database: Source of truth for all searchable entities
- GraphQL API: Primary interface for search queries
- Feature Flags: Controls migration rollout
- Error Monitoring: Captures and alerts on search failures
External Services
- Upstash Search: Target search infrastructure
- Algolia: Legacy search (being migrated from)
- Upstash Workflow: Orchestrates data synchronization jobs
Risks and Mitigations
| Risk | Impact | Likelihood | Mitigation |
|---|---|---|---|
| Cross-tenant data exposure | Critical | Low | Infrastructure-level isolation, security audits, penetration testing |
| Search unavailability | High | Low | 99.9% SLA, automatic failover, monitoring alerts |
| Data synchronization lag | Medium | Medium | <5 minute sync target, monitoring dashboard, automatic retries |
| Migration disruption | High | Low | Feature flag rollback, parallel systems, gradual rollout |
Glossary
| Term | Definition |
|---|---|
| Tenant | An isolated company/organization within the platform |
| Tenant Isolation | Security ensuring one company cannot access another’s data |
| Entity | A searchable business object (client, order, vehicle, etc.) |
| Relevance Ranking | Sorting results by likelihood of matching user intent |
| Typo Tolerance | Returning results despite minor spelling errors |
| Soft Delete | Marking records as deleted without removing from storage |
Change Log
| Date | Version | Changes | Author |
|---|---|---|---|
| 2026-01-09 | 1.0 | Initial PRD created | Product Team |
| 2026-01-15 | 2.0 | Converted to business-focused format: added measurable outcomes, success metrics table, consolidated functional requirements, prioritized user stories, removed technical implementation details | Product Team |