Apply query.