Skip to content

Commit

Permalink
add option to reindex on startup
Browse files Browse the repository at this point in the history
  • Loading branch information
cleydyr committed Jun 1, 2024
1 parent 4a46ea8 commit 2501b49
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/main/java/biblivre/search/ElasticsearchInitializingBean.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package biblivre.search;

import biblivre.circulation.user.IndexableUserDAO;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Component;

@Component
@Profile("elasticsearch")
public class ElasticsearchInitializingBean implements InitializingBean {
@Value("${elasticsearch.startup.action.reindex:false}")
private boolean reindexOnStartup;

@Autowired private IndexableUserDAO indexableUserDAO;

@Override
public void afterPropertiesSet() throws SearchException {
if (reindexOnStartup) {
indexableUserDAO.reindexAll();
}
}
}

0 comments on commit 2501b49

Please sign in to comment.