0

I am trying to run a solr query using solrj against a cassandra table that has a collection that is a java.util.Set.

When my results come back I get an exception when trying to use the getBeans method of the solr document:

java.lang.IllegalArgumentException: Can not set java.util.Set field com.mycompany.entities.MyEntity.groupId to java.util.ArrayList

Basic query code:

 QueryResponse results = getSolrServer().query(query);
 SolrDocumentList documentList = results.getResults();
 List<MyEntity> results = results.getBeans(MyEntity.class);

My entity:

public class MyEntity{
     @Field
     Set<String> groupId;
}

Has anyone had success using a Set and storing it to be retrieved through solr and if so how have you got it to work with solrj?

Kalle Richter
  • 8,008
  • 26
  • 77
  • 177

1 Answers1

0

I found a fix. I ended up using a separate setter that took in a list and put the annotation for @Field on that setter