Example usage for org.springframework.data.solr.core.query FacetOptions hasPivotFields

List of usage examples for org.springframework.data.solr.core.query FacetOptions hasPivotFields

Introduction

In this page you can find the example usage for org.springframework.data.solr.core.query FacetOptions hasPivotFields.

Prototype

public boolean hasPivotFields() 

Source Link

Usage

From source file:org.springframework.data.solr.core.DefaultQueryParser.java

private boolean enableFaceting(SolrQuery solrQuery, FacetQuery query) {
    FacetOptions facetOptions = query.getFacetOptions();
    if (facetOptions == null || (!facetOptions.hasFields() && !facetOptions.hasFacetQueries()
            && !facetOptions.hasPivotFields())) {
        return false;
    }/*from  ww  w. ja v  a 2s.  c om*/
    solrQuery.setFacet(true);
    solrQuery.setFacetMinCount(facetOptions.getFacetMinCount());
    solrQuery.setFacetLimit(facetOptions.getPageable().getPageSize());
    if (facetOptions.getPageable().getPageNumber() > 0) {
        solrQuery.set(FacetParams.FACET_OFFSET, facetOptions.getPageable().getOffset());
    }
    if (FacetOptions.FacetSort.INDEX.equals(facetOptions.getFacetSort())) {
        solrQuery.setFacetSort(FacetParams.FACET_SORT_INDEX);
    }
    return true;
}