seperate query and document.