implement g-search func