Apache Lucene open-source search software
merge FC.DocTerms into BinaryDocValues
Michael McCandless7fe6b9b47c19
diff --git a/lucene/core/src/java/org/apache/lucene/index/BinaryDocValues.java b/lucene/core/src/java/org/apache/lucene/index/BinaryDocValues.javaindex d6f30a7cdda..70ee89ff05a 100644--- a/lucene/core/src/java/org/apache/lucene/index/BinaryDocValues.java+++ b/lucene/core/src/java/org/apache/lucene/index/BinaryDocValues.java@@ -23,6 +23,8 @@ import org.apache.lucene.util.BytesRef;public abstract class BinaryDocValues {// nocommit throws IOE or not?public abstract void get(int docID, BytesRef result);++ public static final byte[] MISSING = new byte[0];public abstract int size();diff --git a/lucene/core/src/java/org/apache/lucene/index/NumericDocValues.java b/lucene/core/src/java/org/apache/lucene/index/NumericDocValues.javaindex 9fefa722836..716cf571ecf 100644--- a/lucene/core/src/java/org/apache/lucene/index/NumericDocValues.java+++ b/lucene/core/src/java/org/apache/lucene/index/NumericDocValues.java@@ -17,7 +17,6 @@ package org.apache.lucene.index;* limitations under the License.*/-// nocommit need marker interface?public abstract class NumericDocValues {// nocommit throws IOE or not?public abstract long get(int docID);diff --git a/lucene/core/src/java/org/apache/lucene/index/SortedDocValues.java b/lucene/core/src/java/org/apache/lucene/index/SortedDocValues.javaindex 05d27fe0cbe..10bb383abe1 100644--- a/lucene/core/src/java/org/apache/lucene/index/SortedDocValues.java+++ b/lucene/core/src/java/org/apache/lucene/index/SortedDocValues.java@@ -39,11 +39,11 @@ public abstract class SortedDocValues extends BinaryDocValues {public void get(int docID, BytesRef result) {int ord = getOrd(docID);if (ord == -1) {- // nocommit what to do ... maybe we need to return- // BytesRef?- throw new IllegalArgumentException("doc has no value");+ result.bytes = MISSING;+ result.length = 0;+ } else {+ lookupOrd(ord, result);}- lookupOrd(ord, result);}public TermsEnum getTermsEnum() {@@ -211,7 +211,6 @@ public abstract class SortedDocValues extends BinaryDocValues {};}- // nocommit binary search lookup?public static class EMPTY extends SortedDocValues {private final int size;@@ -252,10 +251,6 @@ public abstract class SortedDocValues extends BinaryDocValues {// nocommit javadocspublic int lookupTerm(BytesRef key, BytesRef spare) {- // this special case is the reason that Arrays.binarySearch() isn't useful.- if (key == null) {- throw new IllegalArgumentException("key must not be null");- }int low = 0;int high = getValueCount()-1;diff --git a/lucene/core/src/java/org/apache/lucene/search/FieldCache.java b/lucene/core/src/java/org/apache/lucene/search/FieldCache.javaindex 1eb9718e26c..f5e5677ab67 100644--- a/lucene/core/src/java/org/apache/lucene/search/FieldCache.java+++ b/lucene/core/src/java/org/apache/lucene/search/FieldCache.java@@ -26,6 +26,7 @@ import org.apache.lucene.document.FloatField; // for javadocsimport org.apache.lucene.document.IntField; // for javadocsimport org.apache.lucene.document.LongField; // for javadocsimport org.apache.lucene.index.AtomicReader;+import org.apache.lucene.index.BinaryDocValues;import org.apache.lucene.index.DocTermOrds;import org.apache.lucene.index.SortedDocValues;import org.apache.lucene.util.Bits;@@ -480,33 +481,16 @@ public interface FieldCache {*/public Doubles getDoubles(AtomicReader reader, String field, DoubleParser parser, boolean setDocsWithField) throws IOException;- /** Returned by {@link #getTerms} */- // nocommit: merge this api with the BinaryDocValues api?- public abstract static class DocTerms {- /** The BytesRef argument must not be null; the method- * returns the same BytesRef, or an empty (length=0)- * BytesRef if the doc did not have this field or was- * deleted. */- public abstract BytesRef getTerm(int docID, BytesRef ret);-- /** Returns true if this doc has this field and is not- * deleted. */- public abstract boolean exists(int docID);-- /** Number of documents */- public abstract int size();- }-/** Checks the internal cache for an appropriate entry, and if none* is found, reads the term values in <code>field</code>- * and returns a {@link DocTerms} instance, providing a+ * and returns a {@link BinaryDocValues} instance, providing a* method to retrieve the term (as a BytesRef) per document.* @param reader Used to get field values.* @param field Which field contains the strings.* @return The values in the given field for each document.* @throws IOException If any error occurs.*/- public DocTerms getTerms (AtomicReader reader, String field)+ public BinaryDocValues getTerms (AtomicReader reader, String field)throws IOException;/** Expert: just like {@link #getTerms(AtomicReader,String)},@@ -514,12 +498,13 @@ public interface FieldCache {* faster lookups (default is "true"). Note that the* first call for a given reader and field "wins",* subsequent calls will share the same cache entry. */- public DocTerms getTerms (AtomicReader reader, String field, float acceptableOverheadRatio) throws IOException;+ public BinaryDocValues getTerms (AtomicReader reader, String field, float acceptableOverheadRatio) throws IOException;/** Checks the internal cache for an appropriate entry, and if none* is found, reads the term values in <code>field</code>- * and returns a {@link DocTerms} instance, providing a- * method to retrieve the term (as a BytesRef) per document.+ * and returns a {@link SortedDocValues} instance,+ * providing methods to retrieve sort ordinals and terms+ * (as a ByteRef) per document.* @param reader Used to get field values.* @param field Which field contains the strings.* @return The values in the given field for each document.diff --git a/lucene/core/src/java/org/apache/lucene/search/FieldCacheImpl.java b/lucene/core/src/java/org/apache/lucene/search/FieldCacheImpl.javaindex 3bcd97ea99a..9bd194aa37b 100644--- a/lucene/core/src/java/org/apache/lucene/search/FieldCacheImpl.java+++ b/lucene/core/src/java/org/apache/lucene/search/FieldCacheImpl.java@@ -71,7 +71,7 @@ class FieldCacheImpl implements FieldCache {caches.put(Float.TYPE, new FloatCache(this));caches.put(Long.TYPE, new LongCache(this));caches.put(Double.TYPE, new DoubleCache(this));- caches.put(DocTerms.class, new DocTermsCache(this));+ caches.put(BinaryDocValues.class, new BinaryDocValuesCache(this));caches.put(SortedDocValues.class, new SortedDocValuesCache(this));caches.put(DocTermOrds.class, new DocTermOrdsCache(this));caches.put(DocsWithFieldCache.class, new DocsWithFieldCache(this));@@ -1267,11 +1267,11 @@ class FieldCacheImpl implements FieldCache {}}- private static class DocTermsImpl extends DocTerms {+ private static class BinaryDocValuesImpl extends BinaryDocValues {private final PagedBytes.Reader bytes;private final PackedInts.Reader docToOffset;- public DocTermsImpl(PagedBytes.Reader bytes, PackedInts.Reader docToOffset) {+ public BinaryDocValuesImpl(PagedBytes.Reader bytes, PackedInts.Reader docToOffset) {this.bytes = bytes;this.docToOffset = docToOffset;}@@ -1282,29 +1282,42 @@ class FieldCacheImpl implements FieldCache {}@Override- public boolean exists(int docID) {- return docToOffset.get(docID) == 0;+ public void get(int docID, BytesRef ret) {+ final int pointer = (int) docToOffset.get(docID);+ if (pointer == 0) {+ ret.bytes = MISSING;+ ret.offset = 0;+ ret.length = 0;+ } else {+ bytes.fill(ret, pointer);+ }}@Override- public BytesRef getTerm(int docID, BytesRef ret) {- final int pointer = (int) docToOffset.get(docID);- return bytes.fill(ret, pointer);- }+ public boolean isFixedLength() {+ // nocommit hmm+ throw new UnsupportedOperationException();+ }++ @Override+ public int maxLength() {+ // nocommit hmm+ throw new UnsupportedOperationException();+ }}// TODO: this if DocTermsIndex was already created, we// should share it...- public DocTerms getTerms(AtomicReader reader, String field) throws IOException {+ public BinaryDocValues getTerms(AtomicReader reader, String field) throws IOException {return getTerms(reader, field, PackedInts.FAST);}- public DocTerms getTerms(AtomicReader reader, String field, float acceptableOverheadRatio) throws IOException {- return (DocTerms) caches.get(DocTerms.class).get(reader, new CacheKey(field, acceptableOverheadRatio), false);+ public BinaryDocValues getTerms(AtomicReader reader, String field, float acceptableOverheadRatio) throws IOException {+ return (BinaryDocValues) caches.get(BinaryDocValues.class).get(reader, new CacheKey(field, acceptableOverheadRatio), false);}- static final class DocTermsCache extends Cache {- DocTermsCache(FieldCacheImpl wrapper) {+ static final class BinaryDocValuesCache extends Cache {+ BinaryDocValuesCache(FieldCacheImpl wrapper) {super(wrapper);}@@ -1314,26 +1327,7 @@ class FieldCacheImpl implements FieldCache {BinaryDocValues valuesIn = reader.getBinaryDocValues(key.field);if (valuesIn != null) {- final BinaryDocValues ramInstance = valuesIn.newRAMInstance();- return new DocTerms() {-- @Override- public BytesRef getTerm(int docID, BytesRef ret) {- ramInstance.get(docID, ret);- return ret;- }-- @Override- public boolean exists(int docID) {- // nocommit lying ...?- return true;- }-- @Override- public int size() {- return ramInstance.size();- }- };+ return valuesIn;} else {final int maxDoc = reader.maxDoc();Terms terms = reader.terms(key.field);@@ -1398,7 +1392,7 @@ class FieldCacheImpl implements FieldCache {}// maybe an int-only impl?- return new DocTermsImpl(bytes.freeze(true), docToOffset.getMutable());+ return new BinaryDocValuesImpl(bytes.freeze(true), docToOffset.getMutable());}}}diff --git a/lucene/core/src/java/org/apache/lucene/search/FieldComparator.java b/lucene/core/src/java/org/apache/lucene/search/FieldComparator.javaindex f4946ddd7fc..1e2d2bb73ac 100644--- a/lucene/core/src/java/org/apache/lucene/search/FieldComparator.java+++ b/lucene/core/src/java/org/apache/lucene/search/FieldComparator.java@@ -22,10 +22,10 @@ import java.util.Comparator;import org.apache.lucene.index.AtomicReader; // javadocsimport org.apache.lucene.index.AtomicReaderContext;+import org.apache.lucene.index.BinaryDocValues;import org.apache.lucene.index.DocValues;import org.apache.lucene.index.SortedDocValues;import org.apache.lucene.search.FieldCache.ByteParser;-import org.apache.lucene.search.FieldCache.DocTerms;import org.apache.lucene.search.FieldCache.DoubleParser;import org.apache.lucene.search.FieldCache.FloatParser;import org.apache.lucene.search.FieldCache.IntParser;@@ -1755,7 +1755,7 @@ public abstract class FieldComparator<T> {public static final class TermValComparator extends FieldComparator<BytesRef> {private BytesRef[] values;- private DocTerms docTerms;+ private BinaryDocValues docTerms;private final String field;private BytesRef bottom;private final BytesRef tempBR = new BytesRef();@@ -1783,16 +1783,16 @@ public abstract class FieldComparator<T> {@Overridepublic int compareBottom(int doc) {- BytesRef val2 = docTerms.getTerm(doc, tempBR);- if (bottom == null) {- if (val2 == null) {+ docTerms.get(doc, tempBR);+ if (bottom.bytes == BinaryDocValues.MISSING) {+ if (tempBR.bytes == BinaryDocValues.MISSING) {return 0;}return -1;- } else if (val2 == null) {+ } else if (tempBR.bytes == BinaryDocValues.MISSING) {return 1;}- return bottom.compareTo(val2);+ return bottom.compareTo(tempBR);}@Override@@ -1800,7 +1800,7 @@ public abstract class FieldComparator<T> {if (values[slot] == null) {values[slot] = new BytesRef();}- docTerms.getTerm(doc, values[slot]);+ docTerms.get(doc, values[slot]);}@Override@@ -1834,7 +1834,8 @@ public abstract class FieldComparator<T> {@Overridepublic int compareDocToValue(int doc, BytesRef value) {- return docTerms.getTerm(doc, tempBR).compareTo(value);+ docTerms.get(doc, tempBR);+ return tempBR.compareTo(value);}}diff --git a/lucene/core/src/test/org/apache/lucene/search/TestFieldCache.java b/lucene/core/src/test/org/apache/lucene/search/TestFieldCache.javaindex d7ec288ed98..7d1a874833d 100644--- a/lucene/core/src/test/org/apache/lucene/search/TestFieldCache.java+++ b/lucene/core/src/test/org/apache/lucene/search/TestFieldCache.java@@ -230,11 +230,17 @@ public class TestFieldCache extends LuceneTestCase {termsIndex = cache.getTermsIndex(reader, "bogusfield");// getTerms- FieldCache.DocTerms terms = cache.getTerms(reader, "theRandomUnicodeString");+ BinaryDocValues terms = cache.getTerms(reader, "theRandomUnicodeString");assertSame("Second request to cache return same array", terms, cache.getTerms(reader, "theRandomUnicodeString"));assertTrue("doubles Size: " + terms.size() + " is not: " + NUM_DOCS, terms.size() == NUM_DOCS);for (int i = 0; i < NUM_DOCS; i++) {- final BytesRef term = terms.getTerm(i, br);+ terms.get(i, br);+ final BytesRef term;+ if (br.bytes == BinaryDocValues.MISSING) {+ term = null;+ } else {+ term = br;+ }final String s = term == null ? null : term.utf8ToString();assertTrue("for doc " + i + ": " + s + " does not equal: " + unicodeStrings[i], unicodeStrings[i] == null || unicodeStrings[i].equals(s));}diff --git a/lucene/join/src/java/org/apache/lucene/search/join/TermsCollector.java b/lucene/join/src/java/org/apache/lucene/search/join/TermsCollector.javaindex 0fd6a09dd5e..fa0f3c612bc 100644--- a/lucene/join/src/java/org/apache/lucene/search/join/TermsCollector.java+++ b/lucene/join/src/java/org/apache/lucene/search/join/TermsCollector.java@@ -17,7 +17,10 @@ package org.apache.lucene.search.join;* limitations under the License.*/+import java.io.IOException;+import org.apache.lucene.index.AtomicReaderContext;+import org.apache.lucene.index.BinaryDocValues;import org.apache.lucene.index.DocTermOrds;import org.apache.lucene.index.TermsEnum;import org.apache.lucene.search.Collector;@@ -26,8 +29,6 @@ import org.apache.lucene.search.Scorer;import org.apache.lucene.util.BytesRef;import org.apache.lucene.util.BytesRefHash;-import java.io.IOException;-/*** A collector that collects all terms from a specified field matching the query.*@@ -105,14 +106,15 @@ abstract class TermsCollector extends Collector {static class SV extends TermsCollector {final BytesRef spare = new BytesRef();- private FieldCache.DocTerms fromDocTerms;+ private BinaryDocValues fromDocTerms;SV(String field) {super(field);}public void collect(int doc) throws IOException {- collectorTerms.add(fromDocTerms.getTerm(doc, spare));+ fromDocTerms.get(doc, spare);+ collectorTerms.add(spare);}public void setNextReader(AtomicReaderContext context) throws IOException {diff --git a/lucene/join/src/java/org/apache/lucene/search/join/TermsWithScoreCollector.java b/lucene/join/src/java/org/apache/lucene/search/join/TermsWithScoreCollector.javaindex af7c2debd64..1614a14c48c 100644--- a/lucene/join/src/java/org/apache/lucene/search/join/TermsWithScoreCollector.java+++ b/lucene/join/src/java/org/apache/lucene/search/join/TermsWithScoreCollector.java@@ -17,7 +17,10 @@ package org.apache.lucene.search.join;* limitations under the License.*/+import java.io.IOException;+import org.apache.lucene.index.AtomicReaderContext;+import org.apache.lucene.index.BinaryDocValues;import org.apache.lucene.index.DocTermOrds;import org.apache.lucene.index.TermsEnum;import org.apache.lucene.search.Collector;@@ -27,8 +30,6 @@ import org.apache.lucene.util.ArrayUtil;import org.apache.lucene.util.BytesRef;import org.apache.lucene.util.BytesRefHash;-import java.io.IOException;-abstract class TermsWithScoreCollector extends Collector {private final static int INITIAL_ARRAY_SIZE = 256;@@ -90,14 +91,15 @@ abstract class TermsWithScoreCollector extends Collector {static class SV extends TermsWithScoreCollector {final BytesRef spare = new BytesRef();- FieldCache.DocTerms fromDocTerms;+ BinaryDocValues fromDocTerms;SV(String field, ScoreMode scoreMode) {super(field, scoreMode);}public void collect(int doc) throws IOException {- int ord = collectedTerms.add(fromDocTerms.getTerm(doc, spare));+ fromDocTerms.get(doc, spare);+ int ord = collectedTerms.add(spare);if (ord < 0) {ord = -ord - 1;} else {@@ -137,7 +139,8 @@ abstract class TermsWithScoreCollector extends Collector {@Overridepublic void collect(int doc) throws IOException {- int ord = collectedTerms.add(fromDocTerms.getTerm(doc, spare));+ fromDocTerms.get(doc, spare);+ int ord = collectedTerms.add(spare);if (ord < 0) {ord = -ord - 1;} else {diff --git a/lucene/join/src/test/org/apache/lucene/search/join/TestJoinUtil.java b/lucene/join/src/test/org/apache/lucene/search/join/TestJoinUtil.javaindex 2d428761358..954741e94ca 100644--- a/lucene/join/src/test/org/apache/lucene/search/join/TestJoinUtil.java+++ b/lucene/join/src/test/org/apache/lucene/search/join/TestJoinUtil.java@@ -17,6 +17,9 @@ package org.apache.lucene.search.join;* limitations under the License.*/+import java.io.IOException;+import java.util.*;+import org.apache.lucene.analysis.MockAnalyzer;import org.apache.lucene.analysis.MockTokenizer;import org.apache.lucene.document.Document;@@ -24,6 +27,7 @@ import org.apache.lucene.document.Field;import org.apache.lucene.document.TextField;import org.apache.lucene.index.AtomicReader;import org.apache.lucene.index.AtomicReaderContext;+import org.apache.lucene.index.BinaryDocValues;import org.apache.lucene.index.DocTermOrds;import org.apache.lucene.index.DocsEnum;import org.apache.lucene.index.IndexReader;@@ -49,14 +53,11 @@ import org.apache.lucene.search.TopScoreDocCollector;import org.apache.lucene.store.Directory;import org.apache.lucene.util.BytesRef;import org.apache.lucene.util.FixedBitSet;+import org.apache.lucene.util.LuceneTestCase.Slow;import org.apache.lucene.util.LuceneTestCase;import org.apache.lucene.util._TestUtil;-import org.apache.lucene.util.LuceneTestCase.Slow;import org.junit.Test;-import java.io.IOException;-import java.util.*;-public class TestJoinUtil extends LuceneTestCase {public void testSimple() throws Exception {@@ -515,12 +516,13 @@ public class TestJoinUtil extends LuceneTestCase {fromSearcher.search(new TermQuery(new Term("value", uniqueRandomValue)), new Collector() {private Scorer scorer;- private FieldCache.DocTerms terms;+ private BinaryDocValues terms;private final BytesRef spare = new BytesRef();public void collect(int doc) throws IOException {- BytesRef joinValue = terms.getTerm(doc, spare);- if (joinValue == null) {+ terms.get(doc, spare);+ BytesRef joinValue = spare;+ if (joinValue.bytes == BinaryDocValues.MISSING) {return;}@@ -625,12 +627,13 @@ public class TestJoinUtil extends LuceneTestCase {} else {toSearcher.search(new MatchAllDocsQuery(), new Collector() {- private FieldCache.DocTerms terms;+ private BinaryDocValues terms;private int docBase;private final BytesRef spare = new BytesRef();public void collect(int doc) {- JoinScore joinScore = joinValueToJoinScores.get(terms.getTerm(doc, spare));+ terms.get(doc, spare);+ JoinScore joinScore = joinValueToJoinScores.get(spare);if (joinScore == null) {return;}diff --git a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/JoinDocFreqValueSource.java b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/JoinDocFreqValueSource.javaindex 24b6c10854e..1936a494187 100644--- a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/JoinDocFreqValueSource.java+++ b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/JoinDocFreqValueSource.java@@ -21,6 +21,7 @@ import java.io.IOException;import java.util.Map;import org.apache.lucene.index.AtomicReaderContext;+import org.apache.lucene.index.BinaryDocValues;import org.apache.lucene.index.IndexReader;import org.apache.lucene.index.MultiFields;import org.apache.lucene.index.ReaderUtil;@@ -28,7 +29,6 @@ import org.apache.lucene.index.Terms;import org.apache.lucene.index.TermsEnum;import org.apache.lucene.queries.function.FunctionValues;import org.apache.lucene.queries.function.docvalues.IntDocValues;-import org.apache.lucene.search.FieldCache.DocTerms;import org.apache.lucene.util.BytesRef;import org.apache.lucene.util.packed.PackedInts;@@ -56,7 +56,7 @@ public class JoinDocFreqValueSource extends FieldCacheSource {@Overridepublic FunctionValues getValues(Map context, AtomicReaderContext readerContext) throws IOException{- final DocTerms terms = cache.getTerms(readerContext.reader(), field, PackedInts.FAST);+ final BinaryDocValues terms = cache.getTerms(readerContext.reader(), field, PackedInts.FAST);final IndexReader top = ReaderUtil.getTopLevelContext(readerContext).reader();Terms t = MultiFields.getTerms(top, qfield);final TermsEnum termsEnum = t == null ? TermsEnum.EMPTY : t.iterator(null);@@ -68,7 +68,7 @@ public class JoinDocFreqValueSource extends FieldCacheSource {public int intVal(int doc){try {- terms.getTerm(doc, ref);+ terms.get(doc, ref);if (termsEnum.seekExact(ref, true)) {return termsEnum.docFreq();} else {diff --git a/lucene/sandbox/src/java/org/apache/lucene/sandbox/queries/SlowCollatedStringComparator.java b/lucene/sandbox/src/java/org/apache/lucene/sandbox/queries/SlowCollatedStringComparator.javaindex 8bf7d0e0de8..b7f8d11828e 100644--- a/lucene/sandbox/src/java/org/apache/lucene/sandbox/queries/SlowCollatedStringComparator.java+++ b/lucene/sandbox/src/java/org/apache/lucene/sandbox/queries/SlowCollatedStringComparator.java@@ -21,8 +21,8 @@ import java.io.IOException;import java.text.Collator;import org.apache.lucene.index.AtomicReaderContext;+import org.apache.lucene.index.BinaryDocValues;import org.apache.lucene.search.FieldCache;-import org.apache.lucene.search.FieldCache.DocTerms;import org.apache.lucene.search.FieldComparator;import org.apache.lucene.util.BytesRef;@@ -38,7 +38,7 @@ import org.apache.lucene.util.BytesRef;public final class SlowCollatedStringComparator extends FieldComparator<String> {private final String[] values;- private DocTerms currentDocTerms;+ private BinaryDocValues currentDocTerms;private final String field;final Collator collator;private String bottom;@@ -67,7 +67,8 @@ public final class SlowCollatedStringComparator extends FieldComparator<String>@Overridepublic int compareBottom(int doc) {- final String val2 = currentDocTerms.getTerm(doc, tempBR).utf8ToString();+ currentDocTerms.get(doc, tempBR);+ final String val2 = tempBR.bytes == BinaryDocValues.MISSING ? null : tempBR.utf8ToString();if (bottom == null) {if (val2 == null) {return 0;@@ -81,11 +82,11 @@ public final class SlowCollatedStringComparator extends FieldComparator<String>@Overridepublic void copy(int slot, int doc) {- final BytesRef br = currentDocTerms.getTerm(doc, tempBR);- if (br == null) {+ currentDocTerms.get(doc, tempBR);+ if (tempBR.bytes == BinaryDocValues.MISSING) {values[slot] = null;} else {- values[slot] = br.utf8ToString();+ values[slot] = tempBR.utf8ToString();}}@@ -121,12 +122,12 @@ public final class SlowCollatedStringComparator extends FieldComparator<String>@Overridepublic int compareDocToValue(int doc, String value) {- final BytesRef br = currentDocTerms.getTerm(doc, tempBR);+ currentDocTerms.get(doc, tempBR);final String docValue;- if (br == null) {+ if (tempBR.bytes == BinaryDocValues.MISSING) {docValue = null;} else {- docValue = br.utf8ToString();+ docValue = tempBR.utf8ToString();}return compareValues(docValue, value);}