From 178c07f4e481026c47ec0a0a9bfad10fe2434ad4 Mon Sep 17 00:00:00 2001 From: Robert Muir Date: Mon, 19 Nov 2012 14:49:07 +0000 Subject: [PATCH] move datastructures for numerics back to codec git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene4547@1411215 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/lucene/search/FieldCacheImpl.java | 115 ++++++++++-------- 1 file changed, 62 insertions(+), 53 deletions(-) diff --git a/lucene/core/src/java/org/apache/lucene/search/FieldCacheImpl.java b/lucene/core/src/java/org/apache/lucene/search/FieldCacheImpl.java index 0cbf5c62980..c33d5ff01ba 100644 --- a/lucene/core/src/java/org/apache/lucene/search/FieldCacheImpl.java +++ b/lucene/core/src/java/org/apache/lucene/search/FieldCacheImpl.java @@ -400,19 +400,21 @@ class FieldCacheImpl implements FieldCache { protected Object createValue(AtomicReader reader, CacheKey key, boolean setDocsWithField) throws IOException { - int maxDoc = reader.maxDoc(); - final byte[] values; - NumericDocValues valuesIn = reader.getNumericDocValues(key.field); if (valuesIn != null) { + final NumericDocValues ramInstance = valuesIn.newRAMInstance(); + return new Bytes() { + @Override + public byte get(int docID) { + return (byte) ramInstance.get(docID); + } + }; // nocommit should we throw exc if parser isn't // null? if setDocsWithField is true? - values = new byte[maxDoc]; - for(int docID=0;docID