recomputing offset everytime a search is performed