update getRecords method to accept query