【Java开源代码栏目提醒】:网学会员为需要Java开源代码的朋友们搜集整理了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 3710167@qq.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()));
}
}
}
上一篇:
ArticleDeleteAction.java
下一篇:
企业管理论文:电力企业管理中的绩效考核工作