Careeroza
Search indexes
Relevance
🔹 What are Search Indexes?
Search indexes are used for advanced text searching in MongoDB.
They allow you to:
- Search words, phrases
- Handle typos
- Do full-text search
📌 More powerful than normal text indexes
🔹 Where are they used?
Search indexes are mainly used with MongoDB Atlas (Atlas Search feature)
🔹 Why not normal text index?
Normal text index:
- Basic keyword search
Search index:
- Advanced search (like Google)
- Supports fuzzy search, autocomplete
🔹 Features of Search Indexes
- Full-text search
- Fuzzy search (handles spelling mistakes)
- Autocomplete
- Ranking (best results first)
- Phrase search
🔹 Example Use Cases
- E-commerce product search
- Blog/article search
- Movie search
- Chat/message search
🔹 Simple Example Idea
Search for “phone”:
- Returns “smartphone”
- Even matches “fone” (typo)
🔹 How it Works
- MongoDB creates a special search index
- Data is indexed for fast searching
-
Queries use
$searchstage (aggregation)