Universal Search
Description
Universal Search provides users with a persistent, always-accessible global search capability that allows them to quickly find and navigate to any record, screen, or report within the application. The search feature includes intelligent type-ahead suggestions that appear as users type, supports wildcard characters for flexible queries, and maintains a history of recent searches for quick re-execution. The search bar is prominently displayed in the main navigation and remains accessible from every screen in the application.
Mockups
Basic Search Interface
Figure 99.1: Universal search input field persistently displayed in main navigation bar with keyboard shortcut indicator (Ctrl/Cmd+K)
Type-Ahead Suggestions and Categories
Figure 99.2: Type-ahead dropdown showing categorized results (Records, Screens, Reports) after entering 2+ characters with up to 5 items per category
Recent Search History
Figure 99.3: Recent search history dropdown showing up to 15 most recent searches when clicking empty search field, with individual remove icons (X) and "Clear All History" link
Search Results Page
Figure 99.4: Dedicated search results page showing all matching items organized by category (Records, Screens, Reports)
Loading State
Figure 99.5: Loading spinner with "Searching..." message while results are being retrieved
Empty State
Figure 99.6: Empty state displaying "No results found for '[query]'" with helpful suggestions
View complete interactive Figma prototype →
Business Rules
Rule 1: The universal search input field is persistently displayed in the main navigation bar and accessible from all screens in the application. Users can activate search by clicking the search field or using the keyboard shortcut Ctrl+K (Windows/Linux) or Cmd+K (Mac). When activated via keyboard shortcut, any existing text in the field is automatically selected, allowing immediate replacement by typing.
Rule 2: As users type in the search field, the system displays type-ahead suggestions in a dropdown menu after a minimum of 2 characters are entered. Suggestions appear and update dynamically as the user continues typing.
Rule 3: Type-ahead suggestions are organized by category: Records, Screens, and Reports. Each category displays up to 5 matching results, with a maximum of 15 total items shown in the dropdown at once. Results are ordered with exact matches first, followed by partial matches.
Rule 4: If the total number of results across all categories exceeds 15 items, a "View All [X] Results" link appears at the bottom of the dropdown. Clicking this link navigates to a dedicated search results page displaying all matching items, organized and grouped by category (Records, Screens, Reports). Results are sorted the same as the type-ahead dropdown: exact matches first, followed by partial matches.
Rule 5: The search supports wildcard characters using the asterisk () symbol. Users can place wildcards at the beginning, middle, or end of search terms (e.g., "sales", "report", "custmer"). The system treats wildcards as pattern-matching placeholders.
Rule 6: When a user clicks into the empty search field (before typing), the system displays a dropdown showing up to 15 of the most recent searches, ordered from newest to oldest. If the user has no recent search history, the dropdown displays an empty state message: "No recent searches". Clicking a recent search re-executes that query and displays current results. If more than 15 recent searches exist, a "View All [X] Recent Searches" link appears at the bottom of the dropdown, where [X] represents the total number of stored searches (e.g., "View All 42 Recent Searches"). Clicking this link navigates the user to a dedicated page displaying the complete search history with timestamps, grouped by date (Today, Yesterday, Last 7 Days, etc.). Recent searches persist across sessions and are user-specific.
Rule 7: The universal search indexes three primary content types: Screens/Pages, Reports, and Records.
For Records, the system indexes the following fields by record type:
- Billing Items: BILLING_ITEM_NAME, PAYMENT_TERM_REF, BILLING_ITEM_DESCRIPTION, CLIENT_NAME
- Cash Receipts: CASH_RECEIPT_REF, CASH_RECEIPT_COMMENT, CLIENT_NAME, AMOUNT
- Revenue Items: SALES_ITEM_REF, SALES_ITEM_NAME, DEAL_REFERENCE, AMOUNT
- Deals: DEAL_REFERENCE, DEAL_NAME, DEAL_DESCRIPTION, CLIENT_NAME, DEAL_STATUS
- Payment Items: PAYMENT_ITEM_NAME, PAYMENT_ITEM_REF, PAYMENT_METHOD, CLIENT_NAME, AMOUNT
For Screens/Pages: Page titles, navigation labels, screen identifiers, and screen descriptions are indexed.
For Reports: Report names, descriptions, categories, and report identifiers are indexed.
Additional searchable fields may be added as requirements evolve. The development team should consult with the business analyst if clarification is needed on which fields to index for new record types.
Rule 8: Each search result in the type-ahead dropdown displays three elements for identification: the primary record name or reference (e.g., "Q4 Commission Payment" or "CR-2024-12345"), a record type icon indicating whether it's a Billing Item, Cash Receipt, Revenue Item, Deal, Payment Item, Screen/Page, or Report, and one additional field providing context (e.g., Client Name, Deal Reference, or Amount). Full details are available when users navigate to the selected item.
Rule 9: Clicking a search result immediately navigates the user to that item. The search query remains in the search field after navigation. For screens and reports, navigation goes to the fresh/initial state (no pre-populated filters or data). For records, navigation goes to the record detail page.
Rule 10: Users can remove individual items from their recent search history by clicking the "X" icon next to each history entry. Users can clear all recent searches using the "Clear All History" link at the bottom of the history dropdown.
Rule 11: The search query is case-insensitive and matches against multiple fields depending on the item type: names, titles, descriptions, reference names, and other key identifying fields as specified in Rule 7. The system prioritizes exact matches over partial matches in the results ordering.
Rule 12: If a search query returns no results, the system displays an empty state message in the type-ahead dropdown: "No results found for '[query]'" with suggestions to check spelling, use wildcards, or try different keywords. Pressing Enter when no results are shown keeps the dropdown open with the empty state message.
Rule 13: When the search dropdown is open (showing suggestions, results, or history), users can navigate through items using keyboard arrow keys (Up/Down), select an item with Enter, or close the dropdown with Escape. The currently focused item is visually highlighted.
Rule 14: The search field displays a clear button ("X" icon) on the right side when text is entered. Clicking the clear button removes all text from the search field and displays the recent search history dropdown (if history exists), keeping focus in the search input.
Rule 15: Search queries have a maximum length of 100 characters. The system displays a character count indicator (e.g., "90/100") inside the search field on the right side when users reach 90 characters, and prevents additional input at the maximum.
Rule 16: The recent search history stores a maximum of 50 searches per user. A search query is added to history when the user either presses Enter to submit the search, clicks "View All Results", or selects a specific result from the type-ahead dropdown. When the limit is reached, the oldest search is automatically removed when a new search is added. Duplicate searches update the timestamp rather than creating new entries. Users can access all 50 searches through the "View All Recent Searches" page, which displays the complete chronologically-ordered list with timestamps grouped by date and provides options to clear individual searches or entire history.
Rule 17: While search results are loading, the dropdown displays a loading spinner with the message "Searching..." to provide feedback. If results take longer than 5 seconds, the system displays: "Search is taking longer than expected. Please wait..."
Rule 18 (Accessibility): The search interface must meet the following accessibility requirements:
- The search input field must include an ARIA label for screen readers (e.g., aria-label="Global search")
- Keyboard navigation must be fully functional without mouse interaction, supporting all actions described in Rules 1, 13, and 14
- Focus management must maintain clear visual indicators during navigation through search results
- Loading states must announce to assistive technologies using aria-live regions (e.g., aria-live="polite" for "Searching..." message)
- Search results and changes to the dropdown content must be announced to screen readers as they appear
- The currently focused search result item must be indicated with appropriate ARIA attributes (e.g., aria-selected="true")
- All interactive elements (clear button, remove history items, links) must be keyboard accessible and have appropriate ARIA labels
Data Model
Search History Table
The system must store the following data for each user's search history entry:
- id - Unique identifier for the search history entry (primary key)
- user_id - Reference to the user who performed the search (foreign key)
- search_query - The search text entered by the user (text, max 100 characters)
- search_timestamp - Timestamp when the search was executed or updated
- result_count - Number of results returned (integer, optional for analytics)