Fix search paging

* Don't eagerly `refresh_instances` when only `refresh_stubs` is needed
* Inject `expanded` attribute on options in `option_items` template
  context