Unifying locate code, also making it more powerful: it is now able to find
any prefix of the given qualid.