Simple weighted search algorithm