question: public GroupedFacetResult mergeSegmentResults ( int size , int minCount , boolean orderByCount ) throws IOException { if ( segmentFacetCounts != null ) { segmentResults . add ( createSegmentResult ( ) ) ; segmentFacetCounts = null ; } int totalCount = 0 ; int missingCount = 0 ; SegmentResultPriorityQueue segments = new SegmentResultPriorityQueue ( segmentResults . size ( ) ) ; for ( SegmentResult segmentResult : segmentResults ) { missingCount += segmentResult . missing ; if ( segmentResult . mergePos >= segmentResult . maxTermPos ) { continue ; } totalCount += segmentResult . total ; segments . add ( segmentResult ) ; } GroupedFacetResult facetResult = new GroupedFacetResult ( size , minCount , orderByCount , totalCount , missingCount ) ; while ( segments . size ( ) > 0 ) { SegmentResult segmentResult = segments . top ( ) ; BytesRef currentFacetValue = BytesRef . deepCopyOf ( segmentResult . mergeTerm ) ; int count = 0 ; do { count += segmentResult . counts [ segmentResult . mergePos ++ ] ; if ( segmentResult . mergePos < segmentResult . maxTermPos ) { segmentResult . nextTerm ( ) ; segmentResult = segments . updateTop ( ) ; } else { segments . pop ( ) ; segmentResult = segments . top ( ) ; if ( segmentResult == null ) { break ; } } } while ( currentFacetValue . equals ( segmentResult . mergeTerm ) ) ; facetResult . addFacetCount ( currentFacetValue , count ) ; } return facetResult ; }
target:  Returns grouped facet results that were computed over zero or more segments. Grouped facet counts are merged from zero or more segment results.