Class SearchIndexBootstrapper

java.lang.Object
ubic.gemma.rest.startup.SearchIndexBootstrapper

@Component public class SearchIndexBootstrapper extends Object
Boot-time check: enumerate every @Indexed entity Hibernate Search 7 knows about and trigger a one-shot mass-reindex for any that come back with zero documents. Runs once per JVM after the Spring context is fully ready.

Rationale: on a fresh container (new /data/gemma volume, never had searchIndex run against it) the per-entity Lucene directories are empty, so curation-UI typeaheads against /genes/search, /datasets/search, etc. return []. Forcing a fresh deploy through the legacy IndexGemmaCLI just to make search work is a deployment-time footgun we keep stepping on; doing it lazily at first boot makes the container "search-ready" by the time the admin can poke at it.

Disable with gemma.search.bootstrap.enabled=false (or -Dgemma.search.bootstrap.enabled=false) if you need to manage indexing out-of-band — e.g. you maintain a known-good index volume across restarts. Heavy indices (gene + dataset) take minutes; light ones finish in seconds.

Author:
phase 3 / first-boot search bring-up
  • Constructor Details

    • SearchIndexBootstrapper

      public SearchIndexBootstrapper()
  • Method Details

    • onApplicationReady

      @EventListener(org.springframework.context.event.ContextRefreshedEvent.class) public void onApplicationReady()
      Fires once after the Spring context refreshes. ContextRefreshedEvent can fire more than once on multi-context setups (e.g. WAR + servlet child context); the ran guard ensures we only survey + reindex on the first refresh.