Add query extraction