Prompt Library 💻 Coding & Dev Search Function Enhancement
GPT-4o 💻 Coding & Dev Advanced

Search Function Enhancement

Design and implement improvements to an application search function including relevance ranking, autocomplete, filters, and performance optimization.
👁 0 views ⎘ 0 copies ♥ 0 likes

The Prompt

# Search Function Enhancement Guide

You are a senior software engineer specializing in search engineering and information retrieval. Help me design and implement significant improvements to my application's search functionality.

## Current Search Context
- **Application type:** [APP_TYPE] (e-commerce, content platform, SaaS, internal knowledge base, marketplace, mobile app)
- **Current search implementation:** [CURRENT_IMPL] (basic SQL LIKE queries, Elasticsearch, Algolia, no search)
- **Primary user complaint:** [USER_COMPLAINT] (no results for exact terms, slow, no typo tolerance, irrelevant results)
- **Data volume:** [DATA_VOLUME] (rows/documents to search)
- **Tech stack:** [TECH_STACK]
- **Budget for search infrastructure:** [BUDGET]

## Search Enhancement Plan

### 1. Search Quality Assessment
- Current Precision and Recall estimation
- Query failure analysis: zero-result queries, irrelevant top results
- User behavior signals to collect: click-through rate, refinements, abandonment
- Search experience benchmark against industry leaders

### 2. Core Search Improvements

**Relevance & Ranking**
- TF-IDF vs. BM25 relevance scoring explained
- Field-level boosting: title > description > tags > body
- Recency, popularity, and personalization signals
- Learning-to-rank (LTR) introduction

**Text Processing**
- Tokenization and normalization
- Stemming vs. lemmatization for [APP_TYPE]
- Synonym dictionaries and ontologies
- Stopword handling

**Fuzzy & Typo Tolerance**
- Edit distance (Levenshtein) implementation
- Phonetic matching (Soundex, Metaphone) for name search
- N-gram indexing for partial match

### 3. UX Search Features
- Autocomplete and type-ahead: implementation approach
- Query suggestions and "Did you mean?"
- Faceted filtering and dynamic facets
- Search-as-you-type vs. submit search tradeoffs
- Empty state and no-results design

### 4. Technical Implementation
- Elasticsearch vs. Algolia vs. OpenSearch vs. Typesense recommendation for [DATA_VOLUME] and [BUDGET]
- Indexing strategy: full reindex vs. incremental update
- Index design for [APP_TYPE]
- Performance: caching strategies, index warming, shard design

### 5. Code Examples
- Query builder example for [TECH_STACK]
- Autocomplete endpoint design
- Relevance tuning configuration

### 6. A/B Testing Search Quality
- Search quality metrics: MRR, NDCG, CTR
- Experiment design for search improvements
- Continuous improvement feedback loop

Provide specific implementation guidance for [CURRENT_IMPL] and [TECH_STACK].

📝 Fill in the blanks

Replace these placeholders with your own content:

[APP_TYPE]
[CURRENT_IMPL]
[USER_COMPLAINT]
[DATA_VOLUME]
[TECH_STACK]
[BUDGET]

How to use this prompt

1
Copy the prompt

Click "Copy Prompt" above to copy the full prompt text to your clipboard.

2
Replace the placeholders

Swap out anything in [BRACKETS] with your specific details.

3
Paste into GPT-4o

Open your preferred AI assistant and paste the prompt to get started.