mirror of https://github.com/apache/lucene.git
LUCENE-3572: throw exc if you try to sort by term/ord on doc values field, yet it exists but cannot provide a sorted source
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1202384 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
54e30039cd
commit
d4c8f29e23
|
@ -1670,11 +1670,17 @@ public abstract class FieldComparator<T> {
|
|||
|
||||
final IndexDocValues dv = context.reader.docValues(field);
|
||||
if (dv == null) {
|
||||
// This may mean entire segment had no docs with
|
||||
// this DV field; use default field value (empty
|
||||
// byte[]) in this case:
|
||||
termsIndex = IndexDocValues.getDefaultSortedSource(ValueType.BYTES_VAR_SORTED, context.reader.maxDoc());
|
||||
} else {
|
||||
termsIndex = dv.getSource().asSortedSource();
|
||||
if (termsIndex == null) {
|
||||
termsIndex = IndexDocValues.getDefaultSortedSource(ValueType.BYTES_VAR_SORTED, context.reader.maxDoc());
|
||||
// This means segment has doc values, but they are
|
||||
// not able to provide a sorted source; consider
|
||||
// this a hard error:
|
||||
throw new IllegalStateException("DocValues exist for field \"" + field + "\", but not as a sorted source: type=" + dv.getSource().type() + " reader=" + context.reader);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue