From 454dc53483c69a59090bf1c50bb2708e480c5858 Mon Sep 17 00:00:00 2001 From: Simon Willnauer Date: Wed, 30 Oct 2013 11:23:38 +0100 Subject: [PATCH] Add back hashed BytesValues optimization that got lost in a previous commit. Some FieldData consumers require hash values per byte. We provide an optimization that allows to cache the hashes internally if the consumer knows that they are needed this optimization got lost in a previous commit. This commit adds them back and folds the dedicated method into AtomicFieldData#getBytesValues(true|false) --- .../AbstractAtomicNumericFieldData.java | 7 +-- .../index/fielddata/AtomicFieldData.java | 16 ++--- .../fielddata/AtomicGeoPointFieldData.java | 7 +-- .../BytesRefOrdValComparator.java | 2 +- .../BytesRefValComparator.java | 2 +- .../plain/BinaryDVAtomicFieldData.java | 13 ++-- .../plain/DoubleArrayAtomicFieldData.java | 2 +- .../plain/FSTBytesAtomicFieldData.java | 61 +++++++++---------- .../plain/FloatArrayAtomicFieldData.java | 2 +- .../GeoPointDoubleArrayAtomicFieldData.java | 2 +- .../plain/PackedArrayAtomicFieldData.java | 2 +- .../plain/PagedBytesAtomicFieldData.java | 19 +++--- .../plain/SortedSetDVAtomicFieldData.java | 2 +- .../SortedSetDVBytesAtomicFieldData.java | 2 +- .../SortedSetDVNumericAtomicFieldData.java | 14 ++--- .../percolator/QueriesLoaderCollector.java | 4 +- .../percolator/PercolatorService.java | 2 +- .../percolator/QueryCollector.java | 2 +- .../FieldsTermsStringFacetExecutor.java | 2 +- .../strings/TermsStringFacetExecutor.java | 6 +- .../TermsStringOrdinalsFacetExecutor.java | 2 +- .../TermsStatsStringFacetExecutor.java | 2 +- .../fielddata/AbstractFieldDataImplTests.java | 22 +++---- .../index/fielddata/DuelFieldDataTests.java | 4 +- .../index/fielddata/FilterFieldDataTest.java | 19 +++--- 25 files changed, 93 insertions(+), 125 deletions(-) diff --git a/src/main/java/org/elasticsearch/index/fielddata/AbstractAtomicNumericFieldData.java b/src/main/java/org/elasticsearch/index/fielddata/AbstractAtomicNumericFieldData.java index a182f7023bb..1bf5fb03fa6 100644 --- a/src/main/java/org/elasticsearch/index/fielddata/AbstractAtomicNumericFieldData.java +++ b/src/main/java/org/elasticsearch/index/fielddata/AbstractAtomicNumericFieldData.java @@ -42,7 +42,7 @@ public abstract class AbstractAtomicNumericFieldData implements AtomicNumericFie } @Override - public BytesValues getBytesValues() { + public BytesValues getBytesValues(boolean needsHashes) { if (isFloat) { final DoubleValues values = getDoubleValues(); return new BytesValues(values.isMultiValued()) { @@ -106,9 +106,4 @@ public abstract class AbstractAtomicNumericFieldData implements AtomicNumericFie }; } } - - @Override - public BytesValues getHashedBytesValues() { - return getBytesValues(); - } } diff --git a/src/main/java/org/elasticsearch/index/fielddata/AtomicFieldData.java b/src/main/java/org/elasticsearch/index/fielddata/AtomicFieldData.java index 3cf0c74be0b..07df8caef0d 100644 --- a/src/main/java/org/elasticsearch/index/fielddata/AtomicFieldData.java +++ b/src/main/java/org/elasticsearch/index/fielddata/AtomicFieldData.java @@ -53,12 +53,14 @@ public interface AtomicFieldData