How to facet.pivot with spring-data-solr

China☆狼群 提交于 2020-01-06 06:57:10

问题


When declaring this method:

@Query(value = "*:*")
@Facet(pivotFields = {"type","status"}, limit = 10000)
FacetPage<SolrCrimeServer> findAllAndFacetOnTypeAndStatus(Pageable page);

I get

java.lang.IllegalStateException: 2 or more fields required for pivot facets at org.springframework.util.Assert.state(Assert.java:385) at org.springframework.data.solr.core.query.FacetOptions.addFacetOnPivot(FacetOptions.java:150) at org.springframework.data.solr.repository.query.AbstractSolrQuery.extractFacetOptions(AbstractSolrQuery.java:246) at org.springframework.data.solr.repository.query.AbstractSolrQuery.execute(AbstractSolrQuery.java:120)

With version

1.1.1.RELEASE

Thanks.


回答1:


The pivotFields attribute of @Facet takes at least a tuple of field names within one argument.

@Facet(pivotFields={"type,status"}, limit=10000)

You can have a look at SolrQueryMethodTests. Additionally you may vote for this issue.



来源:https://stackoverflow.com/questions/22961464/how-to-facet-pivot-with-spring-data-solr

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!