How Search Works
The search system indexes both companies and products (contacts) from the directory. When you search, results are ranked by relevance across multiple fields.Search Index Structure
The search index contains two types of results:Company Results
Each company in the directory is indexed with its name and description
Product Results
Each product/contact is indexed with the product name, company name, and associated X handles
Weighted Search Fields
Search queries are matched against multiple fields with different weights (defined insrc/lib/search.ts:76-84):
The
threshold: 0.4 value means that results must be at least 60% similar to the search query to be included. Lower values would require more exact matches.Using the Search Page
Enter Your Query
Type your search term in the input field. The search automatically updates as you type (throttled to 300ms)
Review Results
Results display with badges indicating whether they’re a company or product. Each result shows:
- Name and type (Company or Product)
- Description
- Visual company logo (if available)
Search Result Types
Company Results
When you click on a company result, you’re taken to the full company page showing all contacts.Product Results
Product results link directly to the company page with the product name as a query parameter, automatically filtering and highlighting that specific contact.Deduplication
The search system automatically removes duplicate products that have the same name within the same company (src/lib/search.ts:98-110):
URL Query Parameters
Search queries are stored in the URL using theq parameter:
/search?q=cloudflare- Search for “cloudflare”/search?q=api- Search for “api”
The URL updates automatically as you type (with a 300ms throttle), making it easy to share specific search results with others.
Empty States
The search page handles different scenarios: No query entered:- Displays a search icon and prompt to enter a search term
- Shows a friendly message: “No results found for ‘[query]’”
- Suggests trying different keywords
- Displays count: “Found X result(s) for ‘[query]’”
- Lists all matching companies and products
Search Performance
Build-Time Indexing
The search index is built once at module load time (not on every search), making searches extremely fast. All company JSON files are auto-discovered and indexed during the build process.