question: public void testFacetingWithRandomSorts ( ) throws Exception { final int numDocs = TestUtil . nextInt ( random ( ) , 1000 , 3000 ) ; String [ ] fieldsToFacetOn = { "int" , "long" , "str" } ; String [ ] facetMethods = { "enum" , "fc" , "fcs" } ; for ( int i = 1 ; i <= numDocs ; i ++ ) { SolrInputDocument doc = buildRandomDocument ( i ) ; assertU ( adoc ( doc ) ) ; } assertU ( commit ( ) ) ; Collection < String > allFieldNames = getAllSortFieldNames ( ) ; String [ ] fieldNames = new String [ allFieldNames . size ( ) ] ; allFieldNames . toArray ( fieldNames ) ; String f = fieldNames [ TestUtil . nextInt ( random ( ) , 0 , fieldNames . length - 1 ) ] ; String order = 0 == TestUtil . nextInt ( random ( ) , 0 , 1 ) ? " asc" : " desc" ; String sort = f + order + ( f . equals ( "id" ) ? "" : ", id" + order ) ; String rows = "" + TestUtil . nextInt ( random ( ) , 13 , 50 ) ; String facetField = fieldsToFacetOn [ TestUtil . nextInt ( random ( ) , 0 , fieldsToFacetOn . length - 1 ) ] ; String facetMethod = facetMethods [ TestUtil . nextInt ( random ( ) , 0 , facetMethods . length - 1 ) ] ; SentinelIntSet ids = assertFullWalkNoDupsWithFacets ( numDocs , params ( "q" , "*:*" , "fl" , "id," + facetField , "facet" , "true" , "facet.field" , facetField , "facet.method" , facetMethod , "facet.missing" , "true" , "facet.limit" , "-1" , "rows" , rows , "sort" , sort ) ) ; assertEquals ( numDocs , ids . size ( ) ) ; }
target:  test faceting with deep paging