再谈compass:集成站内搜索 - 编程入门网
One(cascade=CascadeType.REFRESH,optional=false)
@JoinColumn(name="productid")
@SearchableReference
public ProductInfo getProduct() {
return product;
}
public void setProduct(ProductInfo product) {
this.product = product;
}
@Id @GeneratedValue
@SearchableId
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
@Column(length=30,nullable=false)
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Column(length=40,nullable=false)
@SearchableProperty(index = Index.UN_TOKENIZED, store = Store.YES)
public String getImagename() {
return imagename;
}
public void setImagename(String imagename) {
this.imagename = imagename;
}
@Column(nullable=false)
public Boolean getVisible() {
return visible;
}
public void setVisible(Boolean visible) {
this.visible = visible;
}
@Transient
public String getImageFullPath(){
return "/images/product/"+ this.getProduct().getType().getTypeid()+ "/"+
this.getProduct().getId()+ "/prototype/"+ this.imagename;
}
@Transient
public String getImage140FullPath(){
image140FullPath = "/images/product/"+ this.getProduct().getType().getTypeid()+ "/"+
this.getProduct().getId()+ "/140x/"+ this.imagename;
return image140FullPath;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
final ProductStyle other = (ProductStyle) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
return true;
}
}
这里要特别注意有集合类型要搜索或显示的时候,两边定义的@SearchableReference或 @SearchableComponent必须一致 再谈compass:集成站内搜索(4)时间:2011-01-05 javaeye lqw86682.再spring的配置文件中加入以下代码 Java代码
|
凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢! |