Skip to main content

Full-Text Search in Azure AI Search

Full-text search matches on plain text stored in an index using tokenization, lexical analysis, and BM25 relevance ranking.

How Full-Text Search Works

Query Execution Stages

1

Query Parsing

Separate terms from operators, create query tree structure
2

Lexical Analysis

Tokenize, lowercase, remove stop words, stem to root forms
3

Document Retrieval

Scan inverted indexes for matching terms
4

Scoring

Rank documents by relevance using BM25 algorithm

Query Architecture

Text Analysis

Analyzers

Transform text during indexing and querying: Standard Analyzer (default):
  • Lowercase all terms
  • Remove punctuation
  • Split on whitespace
  • Remove stop words (“the”, “and”, “is”)
Language Analyzers:
  • 56 languages supported
  • Language-specific stemming
  • Stop word lists
Custom Analyzers:
  • Define tokenization rules
  • Configure character filters
  • Specify token filters

Example Analysis

Input: "The Quick Brown Fox" Standard Analyzer:
  1. Tokenize: [“The”, “Quick”, “Brown”, “Fox”]
  2. Lowercase: [“the”, “quick”, “brown”, “fox”]
  3. Remove stop words: [“quick”, “brown”, “fox”]
Result: ["quick", "brown", "fox"]

BM25 Ranking

Default relevance algorithm combining:

Term Frequency (TF)

How often the term appears in the document

Inverse Document Frequency (IDF)

How rare the term is across all documents

Field Length Normalization

Shorter fields weighted higher Formula:
Where:
  • D = document
  • Q = query
  • qi = query term i
  • f(qi,D) = term frequency
  • |D| = document length
  • avgdl = average document length
  • k1, b = tuning parameters

Query Syntax

Simple Syntax

Default, user-friendly syntax: Boolean Operators:
Phrase Search:
Prefix Search:
Grouping:

Full Lucene Syntax

Advanced features (requires "queryType": "full"): Fielded Search:
Fuzzy Search:
Proximity Search:
Term Boosting:
Regular Expressions:
Wildcard:

Query Parameters

Search Fields

Limit search to specific fields:

Search Mode

Control boolean logic:

Query Type

Choose parser:

Filters

Combine with filters for precise results:
Filter Functions:
  • Comparison: eq, ne, gt, lt, ge, le
  • Logical: and, or, not
  • Functions: search.in(), geo.distance()

Faceted Navigation

Generate category counts:
Response:

Relevance Tuning

Scoring Profiles

Boost specific fields or values:
Apply in query:

Freshness Boosting

Boost recent documents:

Highlighting

Show matching snippets:
Response:

Best Practices

  • Use language analyzers for specific languages
  • Custom analyzers for domain-specific terms
  • Test with representative queries
  • Mark fields searchable only when needed
  • Use separate fields for exact vs analyzed matching
  • Consider field length impact on scoring
  • Use filters to reduce search scope
  • Avoid wildcard prefixes (slow)
  • Limit searchFields to relevant fields
  • Start with default BM25
  • Add scoring profiles incrementally
  • A/B test changes with users

Common Patterns

Next Steps

Vector Search

Add semantic similarity search

Hybrid Search

Combine text and vector queries

Query Examples

More query patterns