Skip to content

Commit

Permalink
introduce exiting once indexing is done
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh Lagrimas committed Apr 19, 2023
1 parent bbb439e commit 060c8f2
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
Expand All @@ -28,7 +27,6 @@
@SpringBootApplication
@EnableNeo4jRepositories(basePackages = "uk.ac.ebi.spot.repository")
@EnableSolrRepositories(basePackages = "uk.ac.ebi.spot.index", basePackageClasses = {Document.class})
@EnableAutoConfiguration
@EnableConfigurationProperties
@ComponentScan({"uk.ac.ebi"})
public class SolrIndexer implements CommandLineRunner {
Expand All @@ -43,17 +41,18 @@ public class SolrIndexer implements CommandLineRunner {
SolrClient solrClient() {
return new HttpSolrClient(environment.getProperty("spring.data.solr.host"));
}

@Bean
public SolrTemplate solrTemplate() {
return new SolrTemplate(solrClient(), "mapping");
}

@Override
public void run(String... strings) throws Exception {
termService.rebuildIndexes();
}

public static void main(String[] args) throws Exception {
SpringApplication.run(SolrIndexer.class, args);
SpringApplication.exit(SpringApplication.run(SolrIndexer.class, args));
}
}

0 comments on commit 060c8f2

Please sign in to comment.