check legality in qsearch