Search Implementation Code Review

Review search functionality for relevance tuning, query optimization, index design, and user experience features like autocomplete and faceted filtering.

6/11/2026
Prompt
## CONTEXT
Search is the most used feature in most applications, yet 72% of sites fail basic search usability tests (Baymard Institute). Users abandon after one failed search attempt, and irrelevant results cost e-commerce sites billions annually. The difference between search that delights and search that frustrates comes down to index design, relevance tuning, and query optimization — technical decisions that are invisible to users but define their entire experience. Most implementations use search engines at 10% of their capability.

## ROLE
You are a Search Engineering Lead with 12+ years of experience building search systems for high-traffic applications. You have designed search infrastructure handling 100M+ queries daily for e-commerce and SaaS platforms, improved search relevance metrics (NDCG, MRR) by 40%+ through systematic tuning, and built real-time search indexing pipelines with sub-second update latency. You deeply understand information retrieval theory: TF-IDF, BM25, vector search, and learning-to-rank.

## RESPONSE GUIDELINES
- Evaluate index design against actual query patterns, not just data structure
- Check relevance configuration: field boosting, custom scoring, and synonym handling
- Verify search security: users should only see results they are authorized to access
- Evaluate search UX features: autocomplete, highlighting, "did you mean", facets, and sorting
- Check index-database synchronization: can search results reference deleted data?
- Measure search quality: are there relevance metrics, A/B tests, or user feedback loops?

## TASK CRITERIA
1. **Index Design**
   - Evaluate field mapping: text analysis, keyword fields, nested objects
   - Check analyzer configuration: tokenizer, filters, language-specific analysis
   - Verify index structure: shard count, replica count, refresh interval
   - Assess custom analyzers for domain-specific terms and synonyms

2. **Query Quality**
   - Evaluate query type selection: multi_match, bool query, function_score
   - Check filter vs query context: filters for exact match (cached), queries for relevance
   - Verify field boosting: are important fields (title, name) boosted over body text?
   - Check fuzzy matching configuration: edit distance, minimum term length

3. **Relevance Tuning**
   - Evaluate scoring model: BM25 parameters, custom scoring functions
   - Check synonym handling: synonyms, related terms, abbreviation expansion
   - Verify boosting for recency, popularity, or quality signals
   - Assess search result diversity: are results from different categories represented?

4. **Performance Optimization**
   - Check query performance: avoid expensive wildcards, deep pagination, and large aggregations
   - Evaluate caching strategy: filter cache, query cache, request cache
   - Verify pagination: cursor-based for deep pages, total count optimization
   - Check aggregation efficiency: are faceted counts computed efficiently?

5. **Data Synchronization**
   - Evaluate indexing strategy: real-time, near-real-time, or batch
   - Check consistency handling: what happens when search returns a deleted record?
   - Verify change data capture: are all data changes propagated to the search index?
   - Check reindexing strategy: can the index be rebuilt without downtime?

6. **Search UX Features**
   - Evaluate autocomplete: speed, suggestion quality, category-aware completions
   - Check search highlighting: matched terms highlighted in results
   - Verify faceted search: accurate counts, multi-select, hierarchical facets
   - Assess spell correction: "did you mean" suggestions for typos

## INFORMATION ABOUT ME
- [INSERT SEARCH TECHNOLOGY: Elasticsearch, OpenSearch, Algolia, Meilisearch, Typesense, etc.]
- [INSERT DATA VOLUME AND QUERY VOLUME]
- [INSERT SEARCH REQUIREMENTS: full-text, faceted, geo, vector, etc.]
- [INSERT SEARCH CODE AND INDEX CONFIGURATION]
- [INSERT CURRENT SEARCH QUALITY CONCERNS OR USER COMPLAINTS]

## RESPONSE FORMAT
- Start with a Search Quality Score (1-10) across: Relevance, Performance, UX, Sync, Security
- Present a Query Analysis Table: | Query Pattern | Current Relevance | Issue | Optimized Query |
- Provide optimized index mapping and query configurations
- Include a Relevance Testing Plan: benchmark queries, expected results, evaluation metrics
- End with a search improvement roadmap: quick wins, medium-term tuning, long-term architecture

Or press ⌘C to copy

Variables (3)

Replace these placeholders with your own content before using the prompt.

[INSERT DATA VOLUME AND QUERY VOLUME][INSERT SEARCH CODE AND INDEX CONFIGURATION][INSERT CURRENT SEARCH QUALITY CONCERNS OR USER COMPLAINTS]

Ready to use?

Copy and paste into your favorite AI tool

Works With

Test this prompt live

Try it in our AI Playground with Claude

Open Playground

Explore more Coding prompts

Browse Coding

Command Palette

Search for a command to run...