in the middle of search terms algo