documentbuilder.java

来自「Jaoso新闻文章发布系统 0.9.1final 程序架构: Struts」· Java 代码 · 共 42 行

JAVA
42
字号
package jaoso.framework.core.search.lucene.builder;

import jaoso.framework.core.search.SearchUtil;
import jaoso.framework.core.search.Searchable;

import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;

/**
 * @author Quake Wang
 * @since 2004-5-21
 * @version $Revision: 1.3 $
 *  
 */
public abstract class DocumentBuilder {
	/**
	 * create lucene document
	 * 
	 * @param entity
	 *            entity
	 * 
	 * @return lucene document
	 */
	public Document createDocument(Searchable entity) {
		Document doc = new Document();
		doc.add(Field.Keyword(SearchUtil.IDENTIFIER, SearchUtil
				.getIdentifier(entity)));
		build(doc, entity);

		return doc;
	}

	/**
	 * DOCUMENT ME!
	 * 
	 * @param doc
	 *            DOCUMENT ME!
	 * @param entity
	 *            DOCUMENT ME!
	 */
	protected abstract void build(Document doc, Searchable entity);
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?