Handle facet terms int overflow better

Facet terms are int based and can overflow with a large number of documents.
Instead of overflowing return Integer.MAX_VALUE.
This fix assumes overflow only happens during the reduce phase.