Skip to content
Ask Sera Search
Ask SeraAnswers from our guides, research and news Search
Learn
Guides
Research
Sectors
Platforms
News
Tools
About

What is query rewriting in AI search?

Query rewriting turns a user's prompt into one or more search queries before retrieval. ChatGPT search rewrites questions into targeted queries.

In short. Query rewriting is turning a user's prompt into one or more search queries before retrieval. A long, conversational question becomes short queries that a search engine or an index can match. OpenAI says ChatGPT search typically rewrites a question into targeted queries that it sends to search providers. Retrieval then runs on the rewritten queries instead of the original prompt.

On this page 6 sections

The evidence

  • Confirmed:

    OpenAI gives an example: for a question about drugs that target CCR8 for cancer, ChatGPT might first send a search partner the query 'CCR8 immunotherapy drug development 2025'.1OpenAI Help Center. Checked Dec 1, 2026

  • Confirmed:

    OpenAI says ChatGPT may use saved memories when it rewrites a search query, and may add a general location based on the user's IP address.1OpenAI Help Center. Checked Dec 1, 2026

  • Confirmed:

    OpenAI's Retrieval API has a rewrite_query setting. It turns 'I'd like to know the height of the main office building.' into 'primary office building height'.2OpenAI API documentation. Checked Dec 1, 2026

  • Observed:

    43.04% of the searches named a country or city, 38% included a year and 27% included the year 2026.

    Promptly Found research, 8,430 ChatGPT web searches, 2026.

Confirmed by the platformObserved in data

Query rewriting is the step between a user's prompt and the search that an AI system runs. The search engine sees the rewritten query, so the pages that come back are the pages that match it.

#How does query rewriting work?

A language model reads the prompt and writes search queries from it. OpenAI's help page on ChatGPT search gives three examples:1

  • A researcher asks "what's the latest on the development of drugs that target CCR8 for cancer?" ChatGPT might first search for "CCR8 immunotherapy drug development 2025". After it reviews the results, it may send a more specific query such as "CHS-114 conference 2025".
  • A user in the San Francisco area asks for good restaurants near them. ChatGPT may search for "top restaurants San Francisco", using a general location from the IP address.
  • With memory turned on, a user who said they are vegan may get the search "good vegan restaurants San Francisco".

Developer tools offer the same step. OpenAI's retrieval guide has a rewrite_query setting that turns "How do I file a complaint about a service issue?" into "service complaint filing process".2 Microsoft's guide to query rewrites in Azure AI Search can generate up to 10 rewrites per query, in preview, to correct typos and add synonyms.3

#What is the difference between query rewriting and query fan-out?

Query rewriting changes how a prompt is worded for search, and query fan-out multiplies the searches. Google's page on AI features says AI Overviews and AI Mode may issue multiple related searches across subtopics and data sources to develop a response.4 The guide What is query fan-out? explains how Google runs these searches.

#How does query rewriting affect which pages AI search finds?

The rewritten query decides which pages a search returns. The paper Query Rewriting for Retrieval-Augmented Large Language Models names the reason: there is a gap between the input text and the knowledge that retrieval needs. Its Rewrite-Retrieve-Read framework first prompts a model to write the query, then runs a web search, then lets the model read the results. A small trained rewriter improved results on question answering tasks.5

Rewritten queries can add terms such as places and years, as OpenAI's examples show. In our study of 8,430 ChatGPT web searches, 43.04% of the searches named a country or city. What ChatGPT searches for before it answers lists the other terms that its queries added, such as years and brand names.

Read next

Used in

Related terms

Questions

Where can developers see a rewritten query?

In OpenAI's Retrieval API, the rewritten query appears in the search_query field of the result when rewrite_query is on. Azure AI Search returns its query rewrites in the response when the debug setting is queryRewrites.

Is query rewriting the same as query fan-out?

No. Query rewriting changes the wording of a prompt into a search query. Query fan-out issues many related searches across subtopics. A system can do both, and OpenAI says ChatGPT may send further, more specific queries after it reviews the first results.

Why do AI systems rewrite queries?

A prompt is written as a request to a chatbot, and a search index matches short queries. The paper Query Rewriting for Retrieval-Augmented Large Language Models says there is a gap between the input text and the knowledge that retrieval needs, and adapts the query to close it.

About this page

Researched and reviewed by Promptly Found. Reviewed Dec 1, 2026. Next review due Mar 2027.

Notes

  1. 1
    Searching the web with ChatGPTOpenAI Help Center · Checked Dec 1, 2026 · Primary source
  2. 2
    RetrievalOpenAI API documentation · Checked Dec 1, 2026 · Primary source
  3. 3
    Rewrite queries with semantic ranker in Azure AI SearchMicrosoft Learn · Checked Dec 1, 2026 · Primary source
  4. 4
    AI features and your websiteGoogle Search Central · Dec 10, 2025 · Checked Dec 1, 2026 · Primary source
  5. 5
    Query Rewriting for Retrieval-Augmented Large Language ModelsarXiv · May 23, 2023 · Checked Dec 1, 2026 · Paper
Cite this page
Citation style

Promptly Found. (2026, December 1). What is query rewriting in AI search? https://promptlyfound.com/glossary/query-rewriting

Revisions 1
First published.