Choose Your Search Strategy
Compare full-text search, semantic vector search, and hybrid search — understand when each excels and how to implement full-text search as a foundation for intelligent queries.
Three ways to search your data
Imagine searching for a book in a library.
Full-text search is like the card catalog — you look up exact words and get books that contain those words. Search for “machine learning” and you get every book with those exact words. Vector search is like asking a librarian: “I want books about teaching computers to learn from data” — the librarian understands the meaning and finds relevant books even if they never mention “machine learning.” Hybrid search combines both: check the catalog AND ask the librarian, then merge the results.
The search strategy decision
| Feature | Full-Text Search | Vector Search | Hybrid Search |
|---|---|---|---|
| Matches on | Exact words and word forms (stemming) | Semantic meaning (embeddings) | Both keywords AND meaning |
| Query example | CONTAINS(Description, 'wireless mouse') | VECTOR_SEARCH(embedding, @queryVector, 10) | Full-text + vector scores fused with RRF |
| Finds synonyms? | Only with thesaurus config | Yes — automatically | Yes |
| Handles typos? | No (exact match) | Somewhat (embedding similarity) | Better than either alone |
| Speed | Very fast (inverted index) | Fast (vector index, ANN) | Moderate (two indexes) |
| Setup complexity | Low — full-text catalog + index | Medium — embeddings + vector index | High — both systems + fusion logic |
| Best for | Exact keyword search, known terminology | Natural language queries, semantic similarity | Production search systems needing both precision and recall |
Decision guide
| Scenario | Best Strategy | Why |
|---|---|---|
| Users search by product SKU or exact name | Full-text | Exact keyword matching is fastest and most precise |
| Users describe what they want in natural language | Vector | Semantic understanding matches intent, not just words |
| E-commerce search with millions of products | Hybrid | Combines keyword precision with semantic recall |
| Log analysis searching for error codes | Full-text | Exact pattern matching, no semantic interpretation needed |
| Customer support finding similar past tickets | Vector | Tickets with the same issue may use completely different words |
| Legal document discovery | Hybrid | Need both exact legal terms AND conceptually similar clauses |
Implementing full-text search
Full-text search uses an inverted index — a data structure that maps words to the rows containing them.
Setup
-- Step 1: Create a full-text catalog
CREATE FULLTEXT CATALOG ProductCatalog AS DEFAULT;
-- Step 2: Create a full-text index on the table
CREATE FULLTEXT INDEX ON Products (
Name LANGUAGE 1033, -- English
Description LANGUAGE 1033
)
KEY INDEX PK_Products -- Must reference a unique index
ON ProductCatalog
WITH (CHANGE_TRACKING AUTO); -- Auto-update when data changes
Querying with CONTAINS and FREETEXT
-- CONTAINS: precise keyword matching with Boolean operators
SELECT Name, Description
FROM Products
WHERE CONTAINS(Description, '"wireless mouse" AND bluetooth');
-- CONTAINS with proximity
SELECT Name FROM Products
WHERE CONTAINS(Description, 'NEAR((battery, life), 5)');
-- FREETEXT: natural language (less precise, broader results)
SELECT Name, Description
FROM Products
WHERE FREETEXT(Description, 'lightweight portable laptop for travel');
Ranking with CONTAINSTABLE and FREETEXTTABLE
-- Get ranked results with relevance scores
SELECT p.Name, ft.RANK
FROM Products p
INNER JOIN CONTAINSTABLE(Products, Description, '"wireless" OR "bluetooth"') ft
ON p.ProductId = ft.[KEY]
ORDER BY ft.RANK DESC;
Exam tip: CONTAINS vs FREETEXT
CONTAINS = precise, supports Boolean operators (AND, OR, NOT, NEAR), wildcards, inflectional forms. Use when users know specific terms.
FREETEXT = natural language, automatically stems words and finds related terms. Use when users describe what they want conversationally.
The exam often presents a scenario where one is clearly better than the other based on query precision requirements.
Scenario: Ingrid's document search at Nordic Shield
Nordic Shield Insurance has 3 million claims documents. Claim adjusters need two types of search:
- Find all claims mentioning a specific policy number → Full-text search (exact term matching)
- Find claims similar to the current claim → Vector search (semantic similarity)
Ingrid implements hybrid search — full-text for known identifiers, vector for conceptual similarity. When an adjuster searches “water damage kitchen renovation,” the system finds claims that match those keywords AND claims about “flood repair” or “plumbing leak restoration” that use different words but mean similar things.
Leo at SearchWave is building product search. Users type queries like 'comfortable shoes for running on trails.' Many relevant products are described with different words like 'cushioned trail runners' or 'off-road athletic footwear.' Which search strategy should Leo implement?
🎬 Video coming soon
Next up: Vector Data: Types, Indexes, and Storage — design your database for vector data with the right data types, indexes, and storage strategies.