Skip to content
mentoor

Query rewriting and routing

For engineers

Turning messy user questions into good search queries: rewriting, expanding, decomposing and sending each to the right index or tool

See where you stand

110 questions across four stages: Understand, Apply, Solve and Judge.

Try 5 questions

Practice items, not counted towards your mastery. No account needed.

Check yourself · 1 of 5

A user's second message is "what about the cheaper one?". Why does searching with that exact text fail?

Choose one answer

Check yourself · 2 of 5

Which question most clearly needs decomposition into sub-queries?

Choose one answer

Check yourself · 3 of 5

Which question should a router send to a SQL source rather than the document index?

Choose one answer

Check yourself · 4 of 5

In HyDE, what does the model write before the search?

Choose one answer

Check yourself · 5 of 5

Why apply "year = 2023" as a metadata filter instead of leaving "2023" in the vector query?

Choose one answer

Topics

  1. Rewriting follow-up questions into search queries4 min read · Resolving pronouns and chat history into a standalone query, fixing typos and adding the terms the documents actually use
  2. Splitting multi-part questions into sub-queries4 min read · Breaking comparisons and multi-hop questions into separate retrievals and merging the evidence before answering
  3. Routing a question to the right index or tool5 min read · Classifying a query by intent with structured output and sending it to a document index, SQL, an API or no retrieval at all
  4. HyDE, multi-query and step-back prompting5 min read · Searching with a hypothetical answer, several paraphrases or a more general question, and when each helps or adds noise
  5. Extracting filters from natural-language questions5 min read · Pulling dates, product names, regions and document types out of a question into structured filters for the search

Start here

110 questions · last verified 2026-12