0
votes

I have a Class called Node and I want to send to solr all Node objects data using Solr Beans functionality.

I had already defined all fields in schema.xml but there is one (field description) that is not been indexed in solr and i dont understand why.

My Class (Model):

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;
}

Index Node Objects:

SolrClient solrClient = new HttpSolrClient(url);
solrClient.addBeans(Node.find.all());
solrClient.commit(); //try catchs ...

my fields in 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"/>

Can someone detects the error in here?

1
Please add imports for the other annotations for clarity.Karl Richter

1 Answers

0
votes

I notice the failure, I was trying to saving a BLOB (@Lob) in a field with type="text_pt and they are different types. So or I create a field who supports blob (binary) or I can accept a bigger String in the db @Column(length = 750)and stay with the same the field type.