package com.iqser.red.service.persistence.management.v1.processor.migration.migrations;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.iqser.red.service.persistence.management.v1.processor.migration.Migration;
import com.iqser.red.service.persistence.management.v1.processor.service.IndexingService;

import lombok.Setter;
import lombok.extern.slf4j.Slf4j;

@Slf4j
@Setter
@Service
public class IndexMigration1 extends Migration {

    private static final String NAME = "Recreate index and index all files";
    private static final long VERSION = 1;
    @Autowired
    private IndexingService indexingService;


    public IndexMigration1() {

        super(NAME, VERSION);
    }


    @Override
    protected void migrate() {

        log.info("Will call SearchService via queue to close, drop, recreate index and reindex all files");
        indexingService.reindex(null, null, true);
    }

}
