I want to index nested document. I have a class ProductBean class which has 3 string type fields and one List of type Object.
@Field
String id;
@Field
String tgtKey_;
@Field
String borrowerId;
@Field
List<Car> cars;
Class Car is as follow.
public class Car {
@Field
String model;
@Field
String cc;
public String getModel() {
return model;
}
public void setModel(String model) {
this.model = model;
}
public String getCc() {
return cc;
}
public void setCc(String cc) {
this.cc = cc;
}
}
Below is the code used to index.
ProductBean bean = new ProductBean("123", "xyz", "23");
List<Car> cars = new ArrayList<Car>();
Car c = new Car();
c.setModel("Pulsar 150");
c.setCc("150");
Car c1 = new Car();
c1.setModel("Desert Strom");
c1.setCc("500");
cars.add(c);
cars.add(c1);
bean.setCars(cars);
server.addBean(bean);
server.commit();
The document is indexed, but data is not correct. I get data as below.
"docs": [
{
"id": "123",
"tgtKey_": "xyz",
"borrowerId": "23",
"cars": [
"com.aiq.solr.poc.Car@25618e91",
"com.aiq.solr.poc.Car@7a92922"
],
"_version_": 1580777018015875000
}
]
Any help on this is highly appreciated. I am using Solr 4.10.3