Merge branch 'wx-dev' of https://github.com/rymcu/forest into wx-dev

This commit is contained in:
ronger 2021-06-03 09:30:33 +08:00
commit ca05c30630
2 changed files with 154 additions and 148 deletions

View File

@ -9,6 +9,7 @@ import com.rymcu.forest.lucene.service.LuceneService;
import com.rymcu.forest.lucene.util.ArticleIndexUtil;
import com.rymcu.forest.lucene.util.LucenePath;
import com.rymcu.forest.lucene.util.SearchUtil;
import com.rymcu.forest.util.Html2TextUtil;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.document.Document;
@ -41,7 +42,8 @@ import java.util.concurrent.Executors;
@Service
public class LuceneServiceImpl implements LuceneService {
@Resource private ArticleLuceneMapper luceneMapper;
@Resource
private ArticleLuceneMapper luceneMapper;
/**
* 将文章的数据解析为一个个关键字词存储到索引文件中
@ -187,7 +189,11 @@ public class LuceneServiceImpl implements LuceneService {
@Override
public List<ArticleLucene> getAllArticleLucene() {
return luceneMapper.getAllArticleLucene();
List<ArticleLucene> list = luceneMapper.getAllArticleLucene();
for (ArticleLucene articleLucene : list) {
articleLucene.setArticleContent(Html2TextUtil.getContent(articleLucene.getArticleContent()));
}
return list;
}
@Override

View File

@ -32,7 +32,7 @@
<result column="article_sponsor_count" property="articleSponsorCount"></result>
</resultMap>
<select id="getAllArticleLucene" resultMap="ResultMapWithBLOBs">
select art.id, art.article_title, content.article_content
select art.id, art.article_title, content.article_content_html as article_content
from forest_article art
join forest_article_content content on art.id = content.id_article
where article_status = 0;