Pull the search UI construction code out into a distinct function.