mirror of https://github.com/apache/lucene.git
don't waste ram
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1459487 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
26b6e88533
commit
c6bc3fdd28
|
@ -26,7 +26,6 @@ import org.apache.lucene.queries.function.FunctionValues;
|
||||||
import org.apache.lucene.queries.function.ValueSource;
|
import org.apache.lucene.queries.function.ValueSource;
|
||||||
import org.apache.lucene.queries.function.ValueSourceScorer;
|
import org.apache.lucene.queries.function.ValueSourceScorer;
|
||||||
import org.apache.lucene.search.FieldCache;
|
import org.apache.lucene.search.FieldCache;
|
||||||
import org.apache.lucene.util.Bits;
|
|
||||||
import org.apache.lucene.util.BytesRef;
|
import org.apache.lucene.util.BytesRef;
|
||||||
import org.apache.lucene.util.CharsRef;
|
import org.apache.lucene.util.CharsRef;
|
||||||
import org.apache.lucene.util.UnicodeUtil;
|
import org.apache.lucene.util.UnicodeUtil;
|
||||||
|
@ -39,7 +38,6 @@ import org.apache.lucene.util.mutable.MutableValueStr;
|
||||||
*/
|
*/
|
||||||
public abstract class DocTermsIndexDocValues extends FunctionValues {
|
public abstract class DocTermsIndexDocValues extends FunctionValues {
|
||||||
protected final SortedDocValues termsIndex;
|
protected final SortedDocValues termsIndex;
|
||||||
protected final Bits valid;
|
|
||||||
protected final ValueSource vs;
|
protected final ValueSource vs;
|
||||||
protected final MutableValueStr val = new MutableValueStr();
|
protected final MutableValueStr val = new MutableValueStr();
|
||||||
protected final BytesRef spare = new BytesRef();
|
protected final BytesRef spare = new BytesRef();
|
||||||
|
@ -48,7 +46,6 @@ public abstract class DocTermsIndexDocValues extends FunctionValues {
|
||||||
public DocTermsIndexDocValues(ValueSource vs, AtomicReaderContext context, String field) throws IOException {
|
public DocTermsIndexDocValues(ValueSource vs, AtomicReaderContext context, String field) throws IOException {
|
||||||
try {
|
try {
|
||||||
termsIndex = FieldCache.DEFAULT.getTermsIndex(context.reader(), field);
|
termsIndex = FieldCache.DEFAULT.getTermsIndex(context.reader(), field);
|
||||||
valid = FieldCache.DEFAULT.getDocsWithField(context.reader(), field);
|
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
throw new DocTermsIndexException(field, e);
|
throw new DocTermsIndexException(field, e);
|
||||||
}
|
}
|
||||||
|
@ -59,7 +56,7 @@ public abstract class DocTermsIndexDocValues extends FunctionValues {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean exists(int doc) {
|
public boolean exists(int doc) {
|
||||||
return valid.get(doc);
|
return ordVal(doc) >= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue