package at.procon.dip.search.startup;

import at.procon.dip.search.service.DocumentLexicalIndexService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

@Component
@RequiredArgsConstructor
@Slf4j
public class LexicalSearchStartupRunner implements CommandLineRunner {

    private final DocumentLexicalIndexService lexicalIndexService;

    @Override
    public void run(String... args) {
        log.info("Refreshing missing lexical search vectors for DOC text representations");
        lexicalIndexService.refreshAllMissingLexicalIndexes();
    }
}
