search resource function, part 1