Instead of if/else, you can call createSearch() before and then check if your config option is not true