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

📄 articledocumentbuilder.java

📁 版本信息:Jaoso新闻文章发布系统 0.9.1beta1 原POPTEN新闻发布系统现更名为Jaoso,不兼容popten,目前不提供popten升级Jaoso的程序.
💻 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 + -