欢迎投稿

今日深度:

solr IndexPageDTO,

solr IndexPageDTO,


package com.paic.wcm.search.client.dto;


import java.text.SimpleDateFormat;
import java.util.Date;


/**
 * 索引对象DTO
 * @author WANGQIANG406
 *
 */
public class IndexPageDTO {


public static final String DATE_PATTERN = "yyyy-MM-dd'T'HH:mm:ss'Z'";


/*
* 标题
*/
private String title;
/*
* 关键字
*/
private String keywords;
/*
* 标签
*/
private String tags;
/*
* 描述
*/
private String desc;
/*
* 正文
*/
private String content;


/*
* 链接
*/
private String link;
/*
* 站点类型
*/
private String type;
/*
* 站点
*/
private String site;
/*
* 最后跟新时间
*/
private Date last_modified;
/*
* redirect链接
*/
private String redirect;


public IndexPageDTO() {
}


public IndexPageDTO(String title, String type, String site, String link,
Date last_modified) {
super();
this.title = title;
this.type = type;
this.site = site;
this.link = link;
this.last_modified = last_modified;
}


public String getTitle() {
return title;
}


public void setTitle(String title) {
this.title = title;
}


public String getKeywords() {
return keywords;
}


public void setKeywords(String keywords) {
this.keywords = keywords;
}


public String getTags() {
return tags;
}


public void setTags(String tags) {
this.tags = tags;
}


public String getDesc() {
return desc;
}


public void setDesc(String desc) {
this.desc = desc;
}


public String getContent() {
return content;
}


public void setContent(String content) {
this.content = content;
}


public String getType() {
return type;
}


public void setType(String type) {
this.type = type;
}


public String getLink() {
return link;
}


public void setLink(String link) {
this.link = link;
}


public String getSite() {
return site;
}


public void setSite(String site) {
this.site = site;
}


public Date getLast_modified() {
return last_modified;
}


public void setLast_modified(Date last_modified) {
this.last_modified = last_modified;
}



public String getRedirect() {
return redirect;
}


public void setRedirect(String redirect) {
this.redirect = redirect;
}


public String toDocString() {
StringBuffer sb = new StringBuffer("<doc>");
if (null != this.getLink()) {
sb.append("<field name=\"link\" >" + formatString(this.getLink())
+ "</field>");
}
if (null != this.getSite()) {
sb.append("<field name=\"site\" >" + formatString(this.getSite())
+ "</field>");
}
if (null != this.getType()) {
sb.append("<field name=\"type\" >" + formatString(this.getType())
+ "</field>");
}
if (null != this.getLast_modified()) {
sb.append("<field name=\"last_modified\" >"
+ new SimpleDateFormat(DATE_PATTERN).format(this
.getLast_modified()) + "</field>");
}


if (null != this.getTitle()) {
sb.append("<field name=\"title\" >" + formatString(this.getTitle())
+ "</field>");
}
if (null != this.getKeywords()) {
sb.append("<field name=\"keywords\" >"
+ formatString(this.getKeywords()) + "</field>");
}
if (null != this.getTags()) {
sb.append("<field name=\"tags\" >" + formatString(this.getTags())
+ "</field>");
}
if (null != this.getDesc()) {
sb.append("<field name=\"desc\" >" + formatString(this.getDesc())
+ "</field>");
}
if (null != this.getContent()) {
sb.append("<field name=\"content\" >"
+ formatString(this.getContent()) + "</field>");
}
if (null != this.getRedirect()) {
sb.append("<field name=\"redirect\" >"
+ formatString(this.getRedirect()) + "</field>");
}


sb.append("</doc>");
return sb.toString();
}


public String formatString(String str) {
if (null == str) {
return "";
}
return str.replace("<", "&lt;").replace(">", "&gt;")
.replace("&", "&amp;").replace("\"", "&quot;")
.replace("'", "&apos;").trim();
}


}

www.htsjk.Com true http://www.htsjk.com/solr/35022.html NewsArticle solr IndexPageDTO, package com.paic.wcm.search.client.dto; import java.text.SimpleDateFormat; import java.util.Date; /**  * 索引对象DTO  * @author WANGQIANG406  *  */ public class IndexPageDTO { public static final String DATE_PAT...
相关文章
    暂无相关文章
评论暂时关闭