📄 articledocumentbuilder.java
字号:
/*
* Created on 2004-7-13
*
*/
package jaoso.news.service;
import jaoso.framework.core.search.Searchable;
import jaoso.framework.core.search.lucene.builder.DocumentBuilder;
import jaoso.news.domain.Article;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
/**
* @author Edgeloner edgeloner@163.com
* @since 2004-7-13
*/
public class ArticleDocumentBuilder extends DocumentBuilder {
//~ Methods ================================================================
/**
* (non-Javadoc)
* @see jaoso.framework.core.search.lucene.builder.DocumentBuilder#build(org.apache.lucene.document.Document, jaoso.framework.core.search.Searchable)
*/
protected void build(Document doc, Searchable entity) {
Article article = (Article) entity;
if (article.getArtTitle() != null) {
doc.add(Field.Text("title", article.getArtTitle()));
}
if (article.getArtContent() != null) {
doc.add(Field.Text("content", article.getArtContent()));
}
if (article.getAuthor()
.getName() != null) {
doc.add(Field.Keyword("author", article.getAuthor().getName()));
}
if (article.getCatalog()
.getCatalogTitle() != null) {
doc.add(Field.Keyword("catalog",
article.getCatalog().getCatalogTitle()));
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -