> ## Documentation Index
> Fetch the complete documentation index at: https://supermemory.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Query Rewriting

> Query Rewriting in supermemory

Query Rewriting is a feature that allows you to rewrite queries to make them more accurate.

<img src="https://mintcdn.com/supermemory/nafXZdsbm5CLncox/images/query-rewriting.png?fit=max&auto=format&n=nafXZdsbm5CLncox&q=85&s=60f21f4668364b51b9759622b2ed52d1" alt="Query Rewriting" width="2096" height="868" data-path="images/query-rewriting.png" />

### Usage

In supermemory, you can enable query rewriting by setting the `rewriteQuery` parameter to `true` in the search API.

<CodeGroup>
  ```bash cURL theme={null}
  curl https://api.supermemory.ai/v3/search \
    --request POST \
    --header 'Authorization: Bearer SUPERMEMORY_API_KEY' \
    --header 'Content-Type: application/json' \
    -d '{
      "q": "What is the capital of France?",
      "rewriteQuery": true
    }'
  ```

  ```typescript theme={null}
  await client.search.create({
    q: "What is the capital of France?",
    rewriteQuery: true,
  });
  ```

  ```python theme={null}
  client.search.create(
      q="What is the capital of France?",
      rewriteQuery=True
  )
  ```
</CodeGroup>

### Notes and limitations

* supermemory generates multiple rewrites, and runs the search through all of them.
* The results are then merged and returned to you.
* There is no additional costs associated with query rewriting.
* While query rewriting makes the quality much better, it also **incurs additional latency**.
* All other features like filtering, hybrid search, recency bias, etc. work with rewritten results as well.
