added more tests for query search
refactorings