add query for logical indexing