private static DocComparatorSource getNonFacetComparatorSource(SortField sf) { String fieldname = sf.getField(); Locale locale = sf.getLocale(); if (locale != null) { return new DocComparatorSource.StringLocaleComparatorSource(fieldname, locale); } int type = sf.getType(); switch (type) { case SortField.INT: return new DocComparatorSource.IntDocComparatorSource(fieldname); case SortField.FLOAT: return new DocComparatorSource.FloatDocComparatorSource(fieldname); case SortField.LONG: return new DocComparatorSource.LongDocComparatorSource(fieldname); case SortField.DOUBLE: return new DocComparatorSource.LongDocComparatorSource(fieldname); case SortField.BYTE: return new DocComparatorSource.ByteDocComparatorSource(fieldname); case SortField.SHORT: return new DocComparatorSource.ShortDocComparatorSource(fieldname); case SortField.CUSTOM: throw new IllegalArgumentException("lucene custom sort no longer supported: " + fieldname); case SortField.STRING: return new DocComparatorSource.StringOrdComparatorSource(fieldname); case SortField.STRING_VAL: return new DocComparatorSource.StringValComparatorSource(fieldname); default: throw new IllegalStateException("Illegal sort type: " + type + ", for field: " + fieldname); } }