Query dsl refactorings

@lauraluiz please review soon.