Apache Lucene open-source search software
LUCENE-4744: Remove FieldCache.StopFillChacheException
Simon Willnauer9705a9d0dea5
diff --git a/lucene/core/src/java/org/apache/lucene/search/FieldCache.java b/lucene/core/src/java/org/apache/lucene/search/FieldCache.javaindex 815d225f8e1..1a3b26baa79 100644--- a/lucene/core/src/java/org/apache/lucene/search/FieldCache.java+++ b/lucene/core/src/java/org/apache/lucene/search/FieldCache.java@@ -19,7 +19,6 @@ package org.apache.lucene.search;import java.io.IOException;import java.io.PrintStream;-import java.text.DecimalFormat;import org.apache.lucene.analysis.NumericTokenStream; // for javadocsimport org.apache.lucene.document.IntField; // for javadocs@@ -28,6 +27,7 @@ import org.apache.lucene.document.LongField; // for javadocsimport org.apache.lucene.document.DoubleField; // for javadocsimport org.apache.lucene.index.DocTermOrds;import org.apache.lucene.index.AtomicReader;+import org.apache.lucene.index.Terms;import org.apache.lucene.index.TermsEnum;import org.apache.lucene.util.Bits;import org.apache.lucene.util.BytesRef;@@ -52,21 +52,22 @@ public interface FieldCache {Object value;}- /**- * Hack: When thrown from a Parser (NUMERIC_UTILS_* ones), this stops- * processing terms and returns the current FieldCache- * array.- * @lucene.internal- */- public static final class StopFillCacheException extends RuntimeException {- }-/*** Marker interface as super-interface to all parsers. It* is used to specify a custom parser to {@link* SortField#SortField(String, FieldCache.Parser)}.*/public interface Parser {++ /**+ * Pulls a {@link TermsEnum} from the given {@link Terms}. This method allows certain parsers+ * to filter the actual TermsEnum before the field cache is filled.+ *+ * @param terms the {@link Terms} instance to create the {@link TermsEnum} from.+ * @return a possibly filtered {@link TermsEnum} instance, this method must not return <code>null</code>.+ * @throws IOException if an {@link IOException} occurs+ */+ public TermsEnum termsEnum(Terms terms) throws IOException;}/** Interface to parse bytes from document fields.@@ -134,6 +135,10 @@ public interface FieldCache {public String toString() {return FieldCache.class.getName()+".DEFAULT_BYTE_PARSER";}+ @Override+ public TermsEnum termsEnum(Terms terms) throws IOException {+ return terms.iterator(null);+ }};/** The default parser for short values, which are encoded by {@link Short#toString(short)} */@@ -150,6 +155,11 @@ public interface FieldCache {public String toString() {return FieldCache.class.getName()+".DEFAULT_SHORT_PARSER";}++ @Override+ public TermsEnum termsEnum(Terms terms) throws IOException {+ return terms.iterator(null);+ }};/** The default parser for int values, which are encoded by {@link Integer#toString(int)} */@@ -162,6 +172,12 @@ public interface FieldCache {// directly from byte[]return Integer.parseInt(term.utf8ToString());}++ @Override+ public TermsEnum termsEnum(Terms terms) throws IOException {+ return terms.iterator(null);+ }+@Overridepublic String toString() {return FieldCache.class.getName()+".DEFAULT_INT_PARSER";@@ -178,6 +194,12 @@ public interface FieldCache {// directly from byte[]return Float.parseFloat(term.utf8ToString());}++ @Override+ public TermsEnum termsEnum(Terms terms) throws IOException {+ return terms.iterator(null);+ }+@Overridepublic String toString() {return FieldCache.class.getName()+".DEFAULT_FLOAT_PARSER";@@ -194,6 +216,12 @@ public interface FieldCache {// directly from byte[]return Long.parseLong(term.utf8ToString());}++ @Override+ public TermsEnum termsEnum(Terms terms) throws IOException {+ return terms.iterator(null);+ }+@Overridepublic String toString() {return FieldCache.class.getName()+".DEFAULT_LONG_PARSER";@@ -210,6 +238,12 @@ public interface FieldCache {// directly from byte[]return Double.parseDouble(term.utf8ToString());}++ @Override+ public TermsEnum termsEnum(Terms terms) throws IOException {+ return terms.iterator(null);+ }+@Overridepublic String toString() {return FieldCache.class.getName()+".DEFAULT_DOUBLE_PARSER";@@ -223,10 +257,14 @@ public interface FieldCache {public static final IntParser NUMERIC_UTILS_INT_PARSER=new IntParser(){@Overridepublic int parseInt(BytesRef term) {- if (NumericUtils.getPrefixCodedIntShift(term) > 0)- throw new StopFillCacheException();return NumericUtils.prefixCodedToInt(term);}++ @Override+ public TermsEnum termsEnum(Terms terms) throws IOException {+ return NumericUtils.filterPrefixCodedInts(terms.iterator(null));+ }+@Overridepublic String toString() {return FieldCache.class.getName()+".NUMERIC_UTILS_INT_PARSER";@@ -240,14 +278,17 @@ public interface FieldCache {public static final FloatParser NUMERIC_UTILS_FLOAT_PARSER=new FloatParser(){@Overridepublic float parseFloat(BytesRef term) {- if (NumericUtils.getPrefixCodedIntShift(term) > 0)- throw new StopFillCacheException();return NumericUtils.sortableIntToFloat(NumericUtils.prefixCodedToInt(term));}@Overridepublic String toString() {return FieldCache.class.getName()+".NUMERIC_UTILS_FLOAT_PARSER";}++ @Override+ public TermsEnum termsEnum(Terms terms) throws IOException {+ return NumericUtils.filterPrefixCodedInts(terms.iterator(null));+ }};/**@@ -257,14 +298,17 @@ public interface FieldCache {public static final LongParser NUMERIC_UTILS_LONG_PARSER = new LongParser(){@Overridepublic long parseLong(BytesRef term) {- if (NumericUtils.getPrefixCodedLongShift(term) > 0)- throw new StopFillCacheException();return NumericUtils.prefixCodedToLong(term);}@Overridepublic String toString() {return FieldCache.class.getName()+".NUMERIC_UTILS_LONG_PARSER";}++ @Override+ public TermsEnum termsEnum(Terms terms) throws IOException {+ return NumericUtils.filterPrefixCodedLongs(terms.iterator(null));+ }};/**@@ -274,14 +318,17 @@ public interface FieldCache {public static final DoubleParser NUMERIC_UTILS_DOUBLE_PARSER = new DoubleParser(){@Overridepublic double parseDouble(BytesRef term) {- if (NumericUtils.getPrefixCodedLongShift(term) > 0)- throw new StopFillCacheException();return NumericUtils.sortableLongToDouble(NumericUtils.prefixCodedToLong(term));}@Overridepublic String toString() {return FieldCache.class.getName()+".NUMERIC_UTILS_DOUBLE_PARSER";}++ @Override+ public TermsEnum termsEnum(Terms terms) throws IOException {+ return NumericUtils.filterPrefixCodedLongs(terms.iterator(null));+ }};@@ -652,7 +699,7 @@ public interface FieldCache {}}-+/*** EXPERT: Generates an array of CacheEntry objects representing all items* currently in the FieldCache.diff --git a/lucene/core/src/java/org/apache/lucene/search/FieldCacheImpl.java b/lucene/core/src/java/org/apache/lucene/search/FieldCacheImpl.javaindex df42c0da747..9430e507558 100644--- a/lucene/core/src/java/org/apache/lucene/search/FieldCacheImpl.java+++ b/lucene/core/src/java/org/apache/lucene/search/FieldCacheImpl.java@@ -140,13 +140,6 @@ class FieldCacheImpl implements FieldCache {public Object getValue() { return value; }}- /**- * Hack: When thrown from a Parser (NUMERIC_UTILS_* ones), this stops- * processing terms and returns the current FieldCache- * array.- */- static final class StopFillCacheException extends RuntimeException {- }// per-segment fieldcaches don't purge until the shared core closes.final SegmentReader.CoreClosedListener purgeCore = new SegmentReader.CoreClosedListener() {@@ -360,32 +353,30 @@ class FieldCacheImpl implements FieldCache {setDocsWithField = false;}}- final TermsEnum termsEnum = terms.iterator(null);+ final TermsEnum termsEnum = parser.termsEnum(terms);+ assert termsEnum != null : "TermsEnum must not be null";DocsEnum docs = null;- try {- while(true) {- final BytesRef term = termsEnum.next();- if (term == null) {+ while(true) {+ final BytesRef term = termsEnum.next();+ if (term == null) {+ break;+ }+ final byte termval = parser.parseByte(term);+ docs = termsEnum.docs(null, docs, DocsEnum.FLAG_NONE);+ while (true) {+ final int docID = docs.nextDoc();+ if (docID == DocIdSetIterator.NO_MORE_DOCS) {break;}- final byte termval = parser.parseByte(term);- docs = termsEnum.docs(null, docs, DocsEnum.FLAG_NONE);- while (true) {- final int docID = docs.nextDoc();- if (docID == DocIdSetIterator.NO_MORE_DOCS) {- break;- }- retArray[docID] = termval;- if (setDocsWithField) {- if (docsWithField == null) {- // Lazy init- docsWithField = new FixedBitSet(maxDoc);- }- docsWithField.set(docID);+ retArray[docID] = termval;+ if (setDocsWithField) {+ if (docsWithField == null) {+ // Lazy init+ docsWithField = new FixedBitSet(maxDoc);}+ docsWithField.set(docID);}}- } catch (FieldCache.StopFillCacheException stop) {}}if (setDocsWithField) {@@ -435,32 +426,30 @@ class FieldCacheImpl implements FieldCache {setDocsWithField = false;}}- final TermsEnum termsEnum = terms.iterator(null);+ final TermsEnum termsEnum = parser.termsEnum(terms);+ assert termsEnum != null : "TermsEnum must not be null";DocsEnum docs = null;- try {- while(true) {- final BytesRef term = termsEnum.next();- if (term == null) {+ while(true) {+ final BytesRef term = termsEnum.next();+ if (term == null) {+ break;+ }+ final short termval = parser.parseShort(term);+ docs = termsEnum.docs(null, docs, DocsEnum.FLAG_NONE);+ while (true) {+ final int docID = docs.nextDoc();+ if (docID == DocIdSetIterator.NO_MORE_DOCS) {break;}- final short termval = parser.parseShort(term);- docs = termsEnum.docs(null, docs, DocsEnum.FLAG_NONE);- while (true) {- final int docID = docs.nextDoc();- if (docID == DocIdSetIterator.NO_MORE_DOCS) {- break;- }- retArray[docID] = termval;- if (setDocsWithField) {- if (docsWithField == null) {- // Lazy init- docsWithField = new FixedBitSet(maxDoc);- }- docsWithField.set(docID);+ retArray[docID] = termval;+ if (setDocsWithField) {+ if (docsWithField == null) {+ // Lazy init+ docsWithField = new FixedBitSet(maxDoc);}+ docsWithField.set(docID);}}- } catch (FieldCache.StopFillCacheException stop) {}}if (setDocsWithField) {@@ -536,37 +525,35 @@ class FieldCacheImpl implements FieldCache {setDocsWithField = false;}}- final TermsEnum termsEnum = terms.iterator(null);+ final TermsEnum termsEnum = parser.termsEnum(terms);+ assert termsEnum != null : "TermsEnum must not be null";DocsEnum docs = null;- try {- while(true) {- final BytesRef term = termsEnum.next();- if (term == null) {+ while(true) {+ final BytesRef term = termsEnum.next();+ if (term == null) {+ break;+ }+ final int termval = parser.parseInt(term);+ if (retArray == null) {+ // late init so numeric fields don't double allocate+ retArray = new int[maxDoc];+ }++ docs = termsEnum.docs(null, docs, DocsEnum.FLAG_NONE);+ while (true) {+ final int docID = docs.nextDoc();+ if (docID == DocIdSetIterator.NO_MORE_DOCS) {break;}- final int termval = parser.parseInt(term);- if (retArray == null) {- // late init so numeric fields don't double allocate- retArray = new int[maxDoc];- }-- docs = termsEnum.docs(null, docs, DocsEnum.FLAG_NONE);- while (true) {- final int docID = docs.nextDoc();- if (docID == DocIdSetIterator.NO_MORE_DOCS) {- break;- }- retArray[docID] = termval;- if (setDocsWithField) {- if (docsWithField == null) {- // Lazy init- docsWithField = new FixedBitSet(maxDoc);- }- docsWithField.set(docID);+ retArray[docID] = termval;+ if (setDocsWithField) {+ if (docsWithField == null) {+ // Lazy init+ docsWithField = new FixedBitSet(maxDoc);}+ docsWithField.set(docID);}}- } catch (FieldCache.StopFillCacheException stop) {}}@@ -689,37 +676,35 @@ class FieldCacheImpl implements FieldCache {setDocsWithField = false;}}- final TermsEnum termsEnum = terms.iterator(null);+ final TermsEnum termsEnum = parser.termsEnum(terms);+ assert termsEnum != null : "TermsEnum must not be null";DocsEnum docs = null;- try {- while(true) {- final BytesRef term = termsEnum.next();- if (term == null) {+ while(true) {+ final BytesRef term = termsEnum.next();+ if (term == null) {+ break;+ }+ final float termval = parser.parseFloat(term);+ if (retArray == null) {+ // late init so numeric fields don't double allocate+ retArray = new float[maxDoc];+ }++ docs = termsEnum.docs(null, docs, DocsEnum.FLAG_NONE);+ while (true) {+ final int docID = docs.nextDoc();+ if (docID == DocIdSetIterator.NO_MORE_DOCS) {break;}- final float termval = parser.parseFloat(term);- if (retArray == null) {- // late init so numeric fields don't double allocate- retArray = new float[maxDoc];- }-- docs = termsEnum.docs(null, docs, DocsEnum.FLAG_NONE);- while (true) {- final int docID = docs.nextDoc();- if (docID == DocIdSetIterator.NO_MORE_DOCS) {- break;- }- retArray[docID] = termval;- if (setDocsWithField) {- if (docsWithField == null) {- // Lazy init- docsWithField = new FixedBitSet(maxDoc);- }- docsWithField.set(docID);+ retArray[docID] = termval;+ if (setDocsWithField) {+ if (docsWithField == null) {+ // Lazy init+ docsWithField = new FixedBitSet(maxDoc);}+ docsWithField.set(docID);}}- } catch (FieldCache.StopFillCacheException stop) {}}@@ -779,37 +764,35 @@ class FieldCacheImpl implements FieldCache {setDocsWithField = false;}}- final TermsEnum termsEnum = terms.iterator(null);+ final TermsEnum termsEnum = parser.termsEnum(terms);+ assert termsEnum != null : "TermsEnum must not be null";DocsEnum docs = null;- try {- while(true) {- final BytesRef term = termsEnum.next();- if (term == null) {+ while(true) {+ final BytesRef term = termsEnum.next();+ if (term == null) {+ break;+ }+ final long termval = parser.parseLong(term);+ if (retArray == null) {+ // late init so numeric fields don't double allocate+ retArray = new long[maxDoc];+ }++ docs = termsEnum.docs(null, docs, DocsEnum.FLAG_NONE);+ while (true) {+ final int docID = docs.nextDoc();+ if (docID == DocIdSetIterator.NO_MORE_DOCS) {break;}- final long termval = parser.parseLong(term);- if (retArray == null) {- // late init so numeric fields don't double allocate- retArray = new long[maxDoc];- }-- docs = termsEnum.docs(null, docs, DocsEnum.FLAG_NONE);- while (true) {- final int docID = docs.nextDoc();- if (docID == DocIdSetIterator.NO_MORE_DOCS) {- break;- }- retArray[docID] = termval;- if (setDocsWithField) {- if (docsWithField == null) {- // Lazy init- docsWithField = new FixedBitSet(maxDoc);- }- docsWithField.set(docID);+ retArray[docID] = termval;+ if (setDocsWithField) {+ if (docsWithField == null) {+ // Lazy init+ docsWithField = new FixedBitSet(maxDoc);}+ docsWithField.set(docID);}}- } catch (FieldCache.StopFillCacheException stop) {}}@@ -870,37 +853,35 @@ class FieldCacheImpl implements FieldCache {setDocsWithField = false;}}- final TermsEnum termsEnum = terms.iterator(null);+ final TermsEnum termsEnum = parser.termsEnum(terms);+ assert termsEnum != null : "TermsEnum must not be null";DocsEnum docs = null;- try {- while(true) {- final BytesRef term = termsEnum.next();- if (term == null) {+ while(true) {+ final BytesRef term = termsEnum.next();+ if (term == null) {+ break;+ }+ final double termval = parser.parseDouble(term);+ if (retArray == null) {+ // late init so numeric fields don't double allocate+ retArray = new double[maxDoc];+ }++ docs = termsEnum.docs(null, docs, DocsEnum.FLAG_NONE);+ while (true) {+ final int docID = docs.nextDoc();+ if (docID == DocIdSetIterator.NO_MORE_DOCS) {break;}- final double termval = parser.parseDouble(term);- if (retArray == null) {- // late init so numeric fields don't double allocate- retArray = new double[maxDoc];- }-- docs = termsEnum.docs(null, docs, DocsEnum.FLAG_NONE);- while (true) {- final int docID = docs.nextDoc();- if (docID == DocIdSetIterator.NO_MORE_DOCS) {- break;- }- retArray[docID] = termval;- if (setDocsWithField) {- if (docsWithField == null) {- // Lazy init- docsWithField = new FixedBitSet(maxDoc);- }- docsWithField.set(docID);+ retArray[docID] = termval;+ if (setDocsWithField) {+ if (docsWithField == null) {+ // Lazy init+ docsWithField = new FixedBitSet(maxDoc);}+ docsWithField.set(docID);}}- } catch (FieldCache.StopFillCacheException stop) {}}if (retArray == null) { // no valuesdiff --git a/lucene/core/src/java/org/apache/lucene/util/NumericUtils.java b/lucene/core/src/java/org/apache/lucene/util/NumericUtils.javaindex f4fcc632339..34ead1fae72 100644--- a/lucene/core/src/java/org/apache/lucene/util/NumericUtils.java+++ b/lucene/core/src/java/org/apache/lucene/util/NumericUtils.java@@ -22,6 +22,8 @@ import org.apache.lucene.document.DoubleField; // javadocsimport org.apache.lucene.document.FloatField; // javadocsimport org.apache.lucene.document.IntField; // javadocsimport org.apache.lucene.document.LongField; // javadocs+import org.apache.lucene.index.FilteredTermsEnum;+import org.apache.lucene.index.TermsEnum;import org.apache.lucene.search.NumericRangeFilter;import org.apache.lucene.search.NumericRangeQuery; // for javadocs@@ -456,4 +458,41 @@ public final class NumericUtils {}+ /**+ * Filters the given {@link TermsEnum} by accepting only prefix coded 64 bit+ * terms with a shift value of <tt>0</tt>.+ *+ * @param termsEnum+ * the terms enum to filter+ * @return a filtered {@link TermsEnum} that only returns prefix coded 64 bit+ * terms with a shift value of <tt>0</tt>.+ */+ public static TermsEnum filterPrefixCodedLongs(TermsEnum termsEnum) {+ return new FilteredTermsEnum(termsEnum, false) {+ @Override+ protected AcceptStatus accept(BytesRef term) {+ return NumericUtils.getPrefixCodedLongShift(term) == 0 ? AcceptStatus.YES : AcceptStatus.END;+ }+ };+ }++ /**+ * Filters the given {@link TermsEnum} by accepting only prefix coded 32 bit+ * terms with a shift value of <tt>0</tt>.+ *+ * @param termsEnum+ * the terms enum to filter+ * @return a filtered {@link TermsEnum} that only returns prefix coded 32 bit+ * terms with a shift value of <tt>0</tt>.+ */+ public static TermsEnum filterPrefixCodedInts(TermsEnum termsEnum) {+ return new FilteredTermsEnum(termsEnum, false) {++ @Override+ protected AcceptStatus accept(BytesRef term) {+ return NumericUtils.getPrefixCodedIntShift(term) == 0 ? AcceptStatus.YES : AcceptStatus.END;+ }+ };+ }+}diff --git a/lucene/core/src/test/org/apache/lucene/search/JustCompileSearch.java b/lucene/core/src/test/org/apache/lucene/search/JustCompileSearch.javaindex 88ef513bf7e..e2fde126487 100644--- a/lucene/core/src/test/org/apache/lucene/search/JustCompileSearch.java+++ b/lucene/core/src/test/org/apache/lucene/search/JustCompileSearch.java@@ -21,6 +21,8 @@ import java.io.IOException;import org.apache.lucene.index.AtomicReaderContext;import org.apache.lucene.index.Norm;+import org.apache.lucene.index.Terms;+import org.apache.lucene.index.TermsEnum;import org.apache.lucene.search.similarities.Similarity;import org.apache.lucene.util.Bits;import org.apache.lucene.util.BytesRef;@@ -95,6 +97,11 @@ final class JustCompileSearch {public long parseLong(BytesRef string) {throw new UnsupportedOperationException(UNSUPPORTED_MSG);}++ @Override+ public TermsEnum termsEnum(Terms terms) {+ throw new UnsupportedOperationException(UNSUPPORTED_MSG);+ }}@@ -104,6 +111,11 @@ final class JustCompileSearch {public double parseDouble(BytesRef term) {throw new UnsupportedOperationException(UNSUPPORTED_MSG);}++ @Override+ public TermsEnum termsEnum(Terms terms) {+ throw new UnsupportedOperationException(UNSUPPORTED_MSG);+ }}diff --git a/lucene/core/src/test/org/apache/lucene/search/TestSort.java b/lucene/core/src/test/org/apache/lucene/search/TestSort.javaindex e143d6a4750..95348834a49 100644--- a/lucene/core/src/test/org/apache/lucene/search/TestSort.java+++ b/lucene/core/src/test/org/apache/lucene/search/TestSort.java@@ -53,6 +53,8 @@ import org.apache.lucene.index.RandomIndexWriter;import org.apache.lucene.index.StorableField;import org.apache.lucene.index.StoredDocument;import org.apache.lucene.index.Term;+import org.apache.lucene.index.Terms;+import org.apache.lucene.index.TermsEnum;import org.apache.lucene.search.BooleanClause.Occur;import org.apache.lucene.search.FieldValueHitQueue.Entry;import org.apache.lucene.store.Directory;@@ -581,6 +583,11 @@ public class TestSort extends LuceneTestCase {public final int parseInt(final BytesRef term) {return (term.bytes[term.offset]-'A') * 123456;}++ @Override+ public TermsEnum termsEnum(Terms terms) throws IOException {+ return terms.iterator(null);+ }}), SortField.FIELD_DOC );assertMatches (full, queryA, sort, "JIHGFEDCBA");assertSaneFieldCaches(getTestName() + " IntParser");@@ -591,6 +598,10 @@ public class TestSort extends LuceneTestCase {public final float parseFloat(final BytesRef term) {return (float) Math.sqrt( term.bytes[term.offset] );}+ @Override+ public TermsEnum termsEnum(Terms terms) throws IOException {+ return terms.iterator(null);+ }}), SortField.FIELD_DOC );assertMatches (full, queryA, sort, "JIHGFEDCBA");assertSaneFieldCaches(getTestName() + " FloatParser");@@ -601,6 +612,11 @@ public class TestSort extends LuceneTestCase {public final long parseLong(final BytesRef term) {return (term.bytes[term.offset]-'A') * 1234567890L;}++ @Override+ public TermsEnum termsEnum(Terms terms) throws IOException {+ return terms.iterator(null);+ }}), SortField.FIELD_DOC );assertMatches (full, queryA, sort, "JIHGFEDCBA");assertSaneFieldCaches(getTestName() + " LongParser");@@ -611,6 +627,10 @@ public class TestSort extends LuceneTestCase {public final double parseDouble(final BytesRef term) {return Math.pow( term.bytes[term.offset], (term.bytes[term.offset]-'A') );}+ @Override+ public TermsEnum termsEnum(Terms terms) throws IOException {+ return terms.iterator(null);+ }}), SortField.FIELD_DOC );assertMatches (full, queryA, sort, "JIHGFEDCBA");assertSaneFieldCaches(getTestName() + " DoubleParser");@@ -621,6 +641,11 @@ public class TestSort extends LuceneTestCase {public final byte parseByte(final BytesRef term) {return (byte) (term.bytes[term.offset]-'A');}++ @Override+ public TermsEnum termsEnum(Terms terms) throws IOException {+ return terms.iterator(null);+ }}), SortField.FIELD_DOC );assertMatches (full, queryA, sort, "JIHGFEDCBA");assertSaneFieldCaches(getTestName() + " ByteParser");@@ -631,6 +656,10 @@ public class TestSort extends LuceneTestCase {public final short parseShort(final BytesRef term) {return (short) (term.bytes[term.offset]-'A');}+ @Override+ public TermsEnum termsEnum(Terms terms) throws IOException {+ return terms.iterator(null);+ }}), SortField.FIELD_DOC );assertMatches (full, queryA, sort, "JIHGFEDCBA");assertSaneFieldCaches(getTestName() + " ShortParser");@@ -708,6 +737,11 @@ public class TestSort extends LuceneTestCase {public final int parseInt(final BytesRef term) {return (term.bytes[term.offset]-'A') * 123456;}++ @Override+ public TermsEnum termsEnum(Terms terms) throws IOException {+ return terms.iterator(null);+ }};@Override