code: public void registerSearchView(@NonNull Activity activity, SearchBoxViewModel searchBoxViewModel) {
          this.searchBoxViewModel = searchBoxViewModel;
          final SearchViewFacade searchView = searchBoxViewModel.getSearchView();
          final SearchManager searchManager = (SearchManager) searchView.getContext().getSystemService(Context.SEARCH_SERVICE);
          //noinspection ConstantConditions: Context.SEARCH_SERVICE must be a valid System service name
          searchView.setSearchableInfo(searchManager.getSearchableInfo(activity.getComponentName()));
          searchView.setIconifiedByDefault(false);
          searchBoxViewModel.addListener(this);
      }
docs: Registers a SearchViewModel to trigger search requests on text change, replacing the current one if any.
  
  @param activity           The searchable activity, see {@link android.app.SearchableInfo}.
  @param searchBoxViewModel a SearchBoxViewModel which SearchView's query text will be used.