search-api: major refactoring of api.