[英]Solr bean fields not working
我有一个称为Node的类,我想使用Solr Beans功能发送以Solr所有Node对象的数据。
我已经在schema.xml中定义了所有字段,但是有一个(字段说明 )未在solr中建立索引,我也不明白为什么。
我的班级(模特):
import com.avaje.ebean.Model;
import org.apache.solr.client.solrj.beans.Field;
public class Node extends Model {
@Id
@Field("id)
public long id;
@Constraints.Required
@Field("code")
public String code;
@Field("name")
public String name;
@Lob //support big strings (bigger than varchar(255) in db
@Field("description")
public String description;
}
索引节点对象:
SolrClient solrClient = new HttpSolrClient(url);
solrClient.addBeans(Node.find.all());
solrClient.commit(); //try catchs ...
我在schema.xml中的字段
<field name="id" type="string" indexed="true" stored="true" required="true" multiValued="false" />
<field name="_version_" type="long" indexed="true" stored="false"/>
<field name="antecessorNodeCode" type="text_pt" indexed="false" stored="true" multiValued="false"/>
<field name="code" type="text_pt" indexed="true" stored="true" multiValued="false"/>
<field name="name" type="text_pt" indexed="true" stored="true" multiValued="false"/>
<field name="description" type="text_pt" indexed="true" stored="true" multiValued="false"/>
<field name="includeEvents" type="text_pt" indexed="true" stored="true" multiValued="true"/>
<field name="excludeEvents" type="text_pt" indexed="true" stored="true" multiValued="true"/>
有人可以在这里检测到错误吗?
我注意到失败了,我试图将BLOB(@Lob)保存在type="text_pt
的字段中,并且它们是不同的类型。所以我创建了一个支持blob(二进制)的字段,或者我可以接受一个更大的String db @Column(length = 750)
并保持相同的字段类型。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.