🐛 草稿文章不更新索引
- 更新删除自动更新索引
This commit is contained in:
parent
8aebd59807
commit
d2be9e3afc
@ -8,6 +8,7 @@ import com.rymcu.forest.entity.Article;
|
|||||||
import com.rymcu.forest.entity.ArticleContent;
|
import com.rymcu.forest.entity.ArticleContent;
|
||||||
import com.rymcu.forest.entity.Tag;
|
import com.rymcu.forest.entity.Tag;
|
||||||
import com.rymcu.forest.entity.User;
|
import com.rymcu.forest.entity.User;
|
||||||
|
import com.rymcu.forest.lucene.service.LuceneService;
|
||||||
import com.rymcu.forest.mapper.ArticleMapper;
|
import com.rymcu.forest.mapper.ArticleMapper;
|
||||||
import com.rymcu.forest.service.ArticleService;
|
import com.rymcu.forest.service.ArticleService;
|
||||||
import com.rymcu.forest.service.CommentService;
|
import com.rymcu.forest.service.CommentService;
|
||||||
@ -41,6 +42,8 @@ public class ArticleServiceImpl extends AbstractService<Article> implements Arti
|
|||||||
private UserService userService;
|
private UserService userService;
|
||||||
@Resource
|
@Resource
|
||||||
private CommentService commentService;
|
private CommentService commentService;
|
||||||
|
@Resource
|
||||||
|
private LuceneService luceneService;
|
||||||
|
|
||||||
@Value("${resource.domain}")
|
@Value("${resource.domain}")
|
||||||
private String domain;
|
private String domain;
|
||||||
@ -176,6 +179,13 @@ public class ArticleServiceImpl extends AbstractService<Article> implements Arti
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
System.out.println("开始增加索引");
|
||||||
|
if (isUpdate) {
|
||||||
|
luceneService.writeArticle(newArticle.getIdArticle().toString());
|
||||||
|
} else {
|
||||||
|
luceneService.updateArticle(newArticle.getIdArticle().toString());
|
||||||
|
}
|
||||||
|
|
||||||
tagService.saveTagArticle(newArticle, articleContentHtml);
|
tagService.saveTagArticle(newArticle, articleContentHtml);
|
||||||
|
|
||||||
if (defaultStatus.equals(newArticle.getArticleStatus())) {
|
if (defaultStatus.equals(newArticle.getArticleStatus())) {
|
||||||
@ -256,6 +266,7 @@ public class ArticleServiceImpl extends AbstractService<Article> implements Arti
|
|||||||
deleteLinkedData(id);
|
deleteLinkedData(id);
|
||||||
// 删除文章
|
// 删除文章
|
||||||
result = articleMapper.deleteByPrimaryKey(id);
|
result = articleMapper.deleteByPrimaryKey(id);
|
||||||
|
luceneService.deleteArticle(id.toString());
|
||||||
if (result < 1) {
|
if (result < 1) {
|
||||||
map.put("message", "删除失败!");
|
map.put("message", "删除失败!");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user