I'm trying to add documents to Solr using SolrJ. Here is my class with @Field annotations:
public class Popular {
@Field("popular_id")
private Long popularId;
@Field("type")
private Type type;
public Long getPopularId() {
return popularId;
}
public void setPopularId(Long popularId) {
this.popularId = popularId;
}
public Type getType() {
return type;
}
public void setType(Type type) {
this.type = type;
}
}
And here is my enum:
public enum Type {
SERVICE,
BRAND,
CITY
}
Here is my method that adds documents to Solr using SolrJ:
private void addPopularItem(SolrClient client, Long popularId, String[] wordsArray)
throws IOException, SolrServerException {
Popular popular = new Popular();
popular.setPopularId(popularId);
popular.setType(Type.valueOf(wordsArray[1]));
client.addBean(popular);
}
And my document is Solr looks like that:
{
"popular_id":[1],
"**type**":["com.XXX.XXX.XXX.indexes.popular.Type:SERVICE"],
"id":"7306406f-4b99-4cee-9c9a-0b7ee84cd5b9",
"_version_":1584849462071656448,
"type_str":["com.XXX.XXX.XXX.indexes.popular.Type:SERVICE"]
}
Is there a way to change that type field so it has only value from Type enum instead of package + class name + value?