.onField( indexFieldName )
.discrete()
.orderedBy( FacetSortOrder.COUNT_ASC )
.createFacetingRequest();
TermQuery term = new TermQuery( new Term( "make", "honda" ) );
FullTextQuery query = fullTextSession.createFullTextQuery( term, Car.class );
FacetManager facetManager = query.getFacetManager();
facetManager.enableFaceting( requestDesc );
facetManager.enableFaceting( requestAsc );
assertFacetCounts( facetManager.getFacets( descendingOrderedFacet ), new int[] { 5, 4, 4, 0 } );
assertFacetCounts( facetManager.getFacets( ascendingOrderedFacet ), new int[] { 0, 4, 4, 5 } );
facetManager.disableFaceting( descendingOrderedFacet );
assertTrue(
"descendingOrderedFacet should be disabled", query.getFacetManager().getFacets(
descendingOrderedFacet
).isEmpty()
);
assertFacetCounts( facetManager.getFacets( ascendingOrderedFacet ), new int[] { 0, 4, 4, 5 } );