/** Returns the native sort type for {@link SortedSetSortField} and {@link SortedNumericSortField}, * {@link SortField#getType()} otherwise */ static SortField.Type getSortFieldType(SortField sortField) { if (sortField instanceof SortedSetSortField) { return SortField.Type.STRING; } else if (sortField instanceof SortedNumericSortField) { return ((SortedNumericSortField) sortField).getNumericType(); } else { return sortField.getType(); } }
/** Wraps a {@link SortedNumericDocValues} as a single-valued view if the field is an instance of {@link SortedNumericSortField}, * returns {@link NumericDocValues} for the field otherwise. */ static NumericDocValues getOrWrapNumeric(LeafReader reader, SortField sortField) throws IOException { if (sortField instanceof SortedNumericSortField) { SortedNumericSortField sf = (SortedNumericSortField) sortField; return SortedNumericSelector.wrap(DocValues.getSortedNumeric(reader, sf.getField()), sf.getSelector(), sf.getNumericType()); } else { return DocValues.getNumeric(reader, sortField.getField()); } }
@Override Sorter.DocComparator getDocComparator(int maxDoc, SortField sortField) throws IOException { assert sortField instanceof SortedNumericSortField; assert finalValues == null && finalValuesCount == null; finalValues = pending.build(); finalValuesCount = pendingCounts.build(); final SortedNumericDocValues docValues = new BufferedSortedNumericDocValues(finalValues, finalValuesCount, docsWithField.iterator()); SortedNumericSortField sf = (SortedNumericSortField) sortField; return Sorter.getDocComparator(maxDoc, sf, () -> null, () -> SortedNumericSelector.wrap(docValues, sf.getSelector(), sf.getNumericType())); }
} else if (sortField instanceof SortedNumericSortField) { sortTypeID = 6; sortType = ((SortedNumericSortField) sortField).getNumericType(); } else { throw new IllegalStateException("Unexpected SortedNumericSortField " + sortField); if (snsf.getNumericType() == SortField.Type.LONG) { output.writeByte((byte) 0); } else if (snsf.getNumericType() == SortField.Type.INT) { output.writeByte((byte) 1); } else if (snsf.getNumericType() == SortField.Type.DOUBLE) { output.writeByte((byte) 2); } else if (snsf.getNumericType() == SortField.Type.FLOAT) { output.writeByte((byte) 3); } else { throw new IllegalStateException("Unexpected SortedNumericSelector type: " + snsf.getNumericType());
public static SortField.Type getSortFieldType(SortField sortField) { if (sortField instanceof SortedSetSortField) { return SortField.Type.STRING; } else if (sortField instanceof SortedNumericSortField) { return ((SortedNumericSortField) sortField).getNumericType(); } else { return sortField.getType(); } } }
/** * Returns the inner {@link SortField.Type} expected for this sort field. */ static SortField.Type extractSortType(SortField sortField) { if (sortField.getComparatorSource() instanceof IndexFieldData.XFieldComparatorSource) { return ((IndexFieldData.XFieldComparatorSource) sortField.getComparatorSource()).reducedType(); } else if (sortField instanceof SortedSetSortField) { return SortField.Type.STRING; } else if (sortField instanceof SortedNumericSortField) { return ((SortedNumericSortField) sortField).getNumericType(); } else if ("LatLonPointSortField".equals(sortField.getClass().getSimpleName())) { // for geo distance sorting return SortField.Type.DOUBLE; } else { return sortField.getType(); } }
((SortedNumericSortField) sortField).getNumericType(), sortField.getReverse()); newSortField.setMissingValue(sortField.getMissingValue());
out.writeBoolean(field.getReverse()); } else if (field instanceof SortedNumericSortField) { switch (((SortedNumericSortField) field).getNumericType()) { case INT: out.writeByte((byte) 1);
/** Returns the native sort type for {@link SortedSetSortField} and {@link SortedNumericSortField}, * {@link SortField#getType()} otherwise */ static SortField.Type getSortFieldType(SortField sortField) { if (sortField instanceof SortedSetSortField) { return SortField.Type.STRING; } else if (sortField instanceof SortedNumericSortField) { return ((SortedNumericSortField) sortField).getNumericType(); } else { return sortField.getType(); } }
public static SortField.Type getSortFieldType(SortField sortField) { if (sortField instanceof SortedSetSortField) { return SortField.Type.STRING; } else if (sortField instanceof SortedNumericSortField) { return ((SortedNumericSortField) sortField).getNumericType(); } else { return sortField.getType(); } } }
public static SortField.Type getSortFieldType(SortField sortField) { if (sortField instanceof SortedSetSortField) { return SortField.Type.STRING; } else if (sortField instanceof SortedNumericSortField) { return ((SortedNumericSortField) sortField).getNumericType(); } else { return sortField.getType(); } } }
private static SortField.Type extractSortType(SortField sortField) { if (sortField instanceof SortedSetSortField) { return SortField.Type.STRING; } else if (sortField instanceof SortedNumericSortField) { return ((SortedNumericSortField) sortField).getNumericType(); } else { return sortField.getType(); } }
/** * Returns the inner {@link SortField.Type} expected for this sort field. */ static SortField.Type extractSortType(SortField sortField) { if (sortField.getComparatorSource() instanceof IndexFieldData.XFieldComparatorSource) { return ((IndexFieldData.XFieldComparatorSource) sortField.getComparatorSource()).reducedType(); } else if (sortField instanceof SortedSetSortField) { return SortField.Type.STRING; } else if (sortField instanceof SortedNumericSortField) { return ((SortedNumericSortField) sortField).getNumericType(); } else if ("LatLonPointSortField".equals(sortField.getClass().getSimpleName())) { // for geo distance sorting return SortField.Type.DOUBLE; } else { return sortField.getType(); } }
/** * Returns the inner {@link SortField.Type} expected for this sort field. */ static SortField.Type extractSortType(SortField sortField) { if (sortField.getComparatorSource() instanceof IndexFieldData.XFieldComparatorSource) { return ((IndexFieldData.XFieldComparatorSource) sortField.getComparatorSource()).reducedType(); } else if (sortField instanceof SortedSetSortField) { return SortField.Type.STRING; } else if (sortField instanceof SortedNumericSortField) { return ((SortedNumericSortField) sortField).getNumericType(); } else if ("LatLonPointSortField".equals(sortField.getClass().getSimpleName())) { // for geo distance sorting return SortField.Type.DOUBLE; } else { return sortField.getType(); } }
/** Wraps a {@link SortedNumericDocValues} as a single-valued view if the field is an instance of {@link SortedNumericSortField}, * returns {@link NumericDocValues} for the field otherwise. */ static NumericDocValues getOrWrapNumeric(LeafReader reader, SortField sortField) throws IOException { if (sortField instanceof SortedNumericSortField) { SortedNumericSortField sf = (SortedNumericSortField) sortField; return SortedNumericSelector.wrap(DocValues.getSortedNumeric(reader, sf.getField()), sf.getSelector(), sf.getNumericType()); } else { return DocValues.getNumeric(reader, sortField.getField()); } }
@Override Sorter.DocComparator getDocComparator(int maxDoc, SortField sortField) throws IOException { assert sortField instanceof SortedNumericSortField; assert finalValues == null && finalValuesCount == null; finalValues = pending.build(); finalValuesCount = pendingCounts.build(); final SortedNumericDocValues docValues = new BufferedSortedNumericDocValues(finalValues, finalValuesCount, docsWithField.iterator()); SortedNumericSortField sf = (SortedNumericSortField) sortField; return Sorter.getDocComparator(maxDoc, sf, () -> null, () -> SortedNumericSelector.wrap(docValues, sf.getSelector(), sf.getNumericType())); }
((SortedNumericSortField) sortField).getNumericType(), sortField.getReverse()); newSortField.setMissingValue(sortField.getMissingValue());
((SortedNumericSortField) sortField).getNumericType(), sortField.getReverse()); newSortField.setMissingValue(sortField.getMissingValue());
out.writeBoolean(field.getReverse()); } else if (field instanceof SortedNumericSortField) { switch (((SortedNumericSortField) field).getNumericType()) { case INT: out.writeByte((byte) 1);
out.writeBoolean(field.getReverse()); } else if (field instanceof SortedNumericSortField) { switch (((SortedNumericSortField) field).getNumericType()) { case INT: out.writeByte((byte) 1);