⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 articledocumentbuilder.java

📁 Jaoso新闻文章发布系统 0.9.1final 程序架构: Struts+Spring+Hibernate 主要功能:   ·新闻采用在线编辑器,可以象使用word一样编辑新闻,可简繁
💻 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 {
	/**
	 * (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 + -