How the Search Bar Works
This document describes how the global search bar in Alpine works — what it searches, how results are returned, and what happens when a user selects something.
Overview
The search bar appears in the top navigation on every page, in both desktop and mobile layouts. It powers two distinct experiences:
-
Typeahead / Autocomplete — real-time constituent suggestions as you type
-
Full-page search — a dedicated results page organized by record type
Typeahead (Inline Autocomplete)
As soon as a user starts typing in the search bar, Alpine queries the /search/constituents endpoint and shows a dropdown of up to 20 matching constituents.
What it matches
The autocomplete searches constituents by:
-
Name
-
Email address
-
Mailing address
-
Notes
-
Custom field values (Properties)
-
Constituent ID (use the format
id: 123to search by ID directly)
How it works
-
Uses the Awesomplete JavaScript library to render the dropdown
-
Fires an AJAX request on each keystroke (cancels the previous request if a new one comes in faster)
-
Each result shows the constituent's primary name, and secondary info (email, address, etc.) depending on what matched
-
Matched terms are highlighted in the dropdown
When you select a result
-
Selecting a constituent → navigates to
/actions?constituent_id={id}(that constituent's action history) -
Clicking "expand" at the bottom of the dropdown → navigates to the full-page search at
/search?query={your query}(available for queries 3+ characters)
Full-Page Search (/search)
The full search page runs parallel queries across all record types and displays results in categorized sections.
What gets searched
|
Section |
What it searches |
|---|---|
|
Names |
Constituent name (fulltext) |
|
Emails |
Constituent email addresses |
|
Phones |
Constituent phone numbers |
|
Addresses |
Constituent mailing addresses |
|
Notes |
Constituent notes |
|
Custom Fields |
Custom field (Property) values |
|
Campaigns |
Campaign names |
|
Categories |
Category names |
|
Tags |
Tag names |
|
Groups |
Group names |
|
Actions |
Action records |
Each section loads independently via AJAX and shows its own pagination.
Relevance ordering (constituent search)
When searching constituents on the full page, results are ranked by how closely the query matches:
-
Exact email match (highest priority)
-
Address
-
Name
-
Phone
-
Notes (lowest priority)
Sport Mode vs. Regular Search
The autocomplete behavior changes depending on whether Sport Mode is enabled for an organization. This is controlled by the sport_limited_search system setting.
Regular search (default)
-
Searches across all constituent fields: name, email, address, mailing address, email salutation, notes, and custom fields
-
Returns up to 100 constituent matches
-
Results are relevance-ordered (email matches first, then address, name, phone, notes)
-
More comprehensive — better for finding a constituent you're not sure how to spell or where they're stored
Sport Mode search
-
Searches a narrower set of fields: name, email, and phone only
-
Returns up to 20 constituent matches
-
Uses a faster query strategy (fulltext + LIKE) optimized for speed over breadth
-
Better suited for high-volume data entry environments where users typically know who they're looking for
What stays the same in both modes
-
Searching by constituent ID (
id: 42) always works -
Custom field (Property) values are still searched in both modes
-
The full-page search (
/search) always uses the comprehensive search regardless of this setting
Which mode is my org using?
Sport Mode is configured at the system level — you won't see a toggle in the UI. If you're unsure which mode your organization is on, ask your account administrator or check with the engineering team.
Search Logic Details
Phone number matching
Phone searches strip formatting characters (parentheses, dashes, spaces) before matching, so (555) 867-5309 and 5558675309 return the same results.
Special search operators
|
Operator |
Example |
What it does |
|---|---|---|
|
|
|
Find a constituent by their exact Alpine ID |
|
|
|
Match records where the field starts with the value |
|
|
|
Match records where the field ends with the value |
Technical Summary
|
Component |
Location |
|---|---|
|
Search bar UI |
Application layout (desktop + mobile) |
|
Autocomplete library |
Awesomplete |
|
Constituent autocomplete endpoint |
|
|
User search endpoint |
|
|
Full-page search endpoint |
|
|
Search orchestration |
|
|
Constituent search scopes |
|
|
Sport Mode setting |
|
|
Pagination |
Pagy gem |