fix: lucene索引没有自动建立

This commit is contained in:
suwen 2021-02-04 17:36:41 +08:00
parent 7820644413
commit 59171fdb9b

View File

@ -8,9 +8,9 @@ import com.rymcu.forest.dto.ArticleDTO;
import com.rymcu.forest.lucene.model.ArticleLucene; import com.rymcu.forest.lucene.model.ArticleLucene;
import com.rymcu.forest.lucene.service.LuceneService; import com.rymcu.forest.lucene.service.LuceneService;
import com.rymcu.forest.util.Utils; import com.rymcu.forest.util.Utils;
import lombok.extern.log4j.Log4j2;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.PostConstruct;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List; import java.util.List;
@ -26,11 +26,9 @@ public class LuceneSearchController {
@Resource private LuceneService luceneService; @Resource private LuceneService luceneService;
@GetMapping("/createIndex") @PostConstruct
public GlobalResult createIndex( public GlobalResult createIndex() {
@RequestParam(required = false, defaultValue = "0") Integer limit, System.out.println(">>>>>>>>>init index<<<<<<<<<<<");
@RequestParam(required = false, defaultValue = "1000") Integer offset) {
// 拉取数据
luceneService.writeArticle(luceneService.getAllArticleLucene()); luceneService.writeArticle(luceneService.getAllArticleLucene());
return GlobalResultGenerator.genSuccessResult("创建索引成功"); return GlobalResultGenerator.genSuccessResult("创建索引成功");
} }