From text to plan
A raw query is just a string. Parsing turns it into a structured query: terms, phrases, operators, and filters. Rewriting then improves that query to match more of what the user meant.
Parsing steps
- Tokenize and normalize the same way the index did, so terms line up.
- Detect phrases when words in quotes must stay adjacent.
- Extract filters like a date range or a category.
Rewriting techniques
- Synonym expansion adds related terms so a search for car also matches automobile.
- Stop word handling drops or down weights low value words.
- Spelling correction fixes typos before retrieval.
- Stemming alignment ensures query and index use the same word forms.
A trade off
More aggressive rewriting finds more results but risks drifting from intent. Systems weight expanded terms lower than the original so the user query still dominates.
Diagram
Key idea
Parsing structures the query and rewriting expands it toward intent, while keeping the original terms dominant to avoid drift.