internal refactoring of field data type
This commit is contained in:
parent
d0bf743ab4
commit
34ed85a40f
|
@ -24,7 +24,7 @@ import org.apache.lucene.search.DocIdSet;
|
|||
import org.apache.lucene.search.Filter;
|
||||
import org.elasticsearch.common.lucene.docset.GetDocSet;
|
||||
import org.elasticsearch.index.cache.field.data.FieldDataCache;
|
||||
import org.elasticsearch.index.field.data.FieldData;
|
||||
import org.elasticsearch.index.field.data.FieldDataType;
|
||||
import org.elasticsearch.index.field.data.NumericFieldData;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -42,11 +42,11 @@ public class GeoBoundingBoxFilter extends Filter {
|
|||
|
||||
private final String lonFieldName;
|
||||
|
||||
private final FieldData.Type fieldDataType;
|
||||
private final FieldDataType fieldDataType;
|
||||
|
||||
private final FieldDataCache fieldDataCache;
|
||||
|
||||
public GeoBoundingBoxFilter(Point topLeft, Point bottomRight, String latFieldName, String lonFieldName, FieldData.Type fieldDataType, FieldDataCache fieldDataCache) {
|
||||
public GeoBoundingBoxFilter(Point topLeft, Point bottomRight, String latFieldName, String lonFieldName, FieldDataType fieldDataType, FieldDataCache fieldDataCache) {
|
||||
this.topLeft = topLeft;
|
||||
this.bottomRight = bottomRight;
|
||||
this.latFieldName = latFieldName;
|
||||
|
|
|
@ -25,7 +25,7 @@ import org.apache.lucene.search.FieldComparatorSource;
|
|||
import org.elasticsearch.ElasticSearchIllegalArgumentException;
|
||||
import org.elasticsearch.common.unit.DistanceUnit;
|
||||
import org.elasticsearch.index.cache.field.data.FieldDataCache;
|
||||
import org.elasticsearch.index.field.data.FieldData;
|
||||
import org.elasticsearch.index.field.data.FieldDataType;
|
||||
import org.elasticsearch.index.field.data.NumericFieldData;
|
||||
import org.elasticsearch.index.mapper.FieldMapper;
|
||||
import org.elasticsearch.index.mapper.MapperService;
|
||||
|
@ -92,7 +92,7 @@ public class GeoDistanceDataComparator extends FieldComparator {
|
|||
|
||||
protected final FieldDataCache fieldDataCache;
|
||||
|
||||
protected final FieldData.Type fieldDataType;
|
||||
protected final FieldDataType fieldDataType;
|
||||
|
||||
protected NumericFieldData latFieldData;
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ import org.apache.lucene.search.Filter;
|
|||
import org.elasticsearch.common.lucene.docset.GetDocSet;
|
||||
import org.elasticsearch.common.unit.DistanceUnit;
|
||||
import org.elasticsearch.index.cache.field.data.FieldDataCache;
|
||||
import org.elasticsearch.index.field.data.FieldData;
|
||||
import org.elasticsearch.index.field.data.FieldDataType;
|
||||
import org.elasticsearch.index.field.data.NumericFieldData;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -47,12 +47,12 @@ public class GeoDistanceFilter extends Filter {
|
|||
|
||||
private final String lonFieldName;
|
||||
|
||||
private final FieldData.Type fieldDataType;
|
||||
private final FieldDataType fieldDataType;
|
||||
|
||||
private final FieldDataCache fieldDataCache;
|
||||
|
||||
public GeoDistanceFilter(double lat, double lon, double distance, GeoDistance geoDistance, String latFieldName, String lonFieldName,
|
||||
FieldData.Type fieldDataType, FieldDataCache fieldDataCache) {
|
||||
FieldDataType fieldDataType, FieldDataCache fieldDataCache) {
|
||||
this.lat = lat;
|
||||
this.lon = lon;
|
||||
this.distance = distance;
|
||||
|
|
|
@ -24,7 +24,7 @@ import org.apache.lucene.search.DocIdSet;
|
|||
import org.apache.lucene.search.Filter;
|
||||
import org.elasticsearch.common.lucene.docset.GetDocSet;
|
||||
import org.elasticsearch.index.cache.field.data.FieldDataCache;
|
||||
import org.elasticsearch.index.field.data.FieldData;
|
||||
import org.elasticsearch.index.field.data.FieldDataType;
|
||||
import org.elasticsearch.index.field.data.NumericFieldData;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -40,11 +40,11 @@ public class GeoPolygonFilter extends Filter {
|
|||
|
||||
private final String lonFieldName;
|
||||
|
||||
private final FieldData.Type fieldDataType;
|
||||
private final FieldDataType fieldDataType;
|
||||
|
||||
private final FieldDataCache fieldDataCache;
|
||||
|
||||
public GeoPolygonFilter(Point[] points, String latFieldName, String lonFieldName, FieldData.Type fieldDataType, FieldDataCache fieldDataCache) {
|
||||
public GeoPolygonFilter(Point[] points, String latFieldName, String lonFieldName, FieldDataType fieldDataType, FieldDataCache fieldDataCache) {
|
||||
this.points = points;
|
||||
this.latFieldName = latFieldName;
|
||||
this.lonFieldName = lonFieldName;
|
||||
|
|
|
@ -22,6 +22,7 @@ package org.elasticsearch.index.cache.field.data;
|
|||
import org.apache.lucene.index.IndexReader;
|
||||
import org.elasticsearch.common.component.CloseableComponent;
|
||||
import org.elasticsearch.index.field.data.FieldData;
|
||||
import org.elasticsearch.index.field.data.FieldDataType;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
@ -30,9 +31,7 @@ import java.io.IOException;
|
|||
*/
|
||||
public interface FieldDataCache extends CloseableComponent {
|
||||
|
||||
<T extends FieldData> T cache(Class<T> type, IndexReader reader, String fieldName) throws IOException;
|
||||
|
||||
FieldData cache(FieldData.Type type, IndexReader reader, String fieldName) throws IOException;
|
||||
FieldData cache(FieldDataType type, IndexReader reader, String fieldName) throws IOException;
|
||||
|
||||
String type();
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ import org.elasticsearch.index.AbstractIndexComponent;
|
|||
import org.elasticsearch.index.Index;
|
||||
import org.elasticsearch.index.cache.field.data.FieldDataCache;
|
||||
import org.elasticsearch.index.field.data.FieldData;
|
||||
import org.elasticsearch.index.field.data.FieldDataType;
|
||||
import org.elasticsearch.index.settings.IndexSettings;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -41,11 +42,7 @@ public class NoneFieldDataCache extends AbstractIndexComponent implements FieldD
|
|||
logger.debug("Using no field cache");
|
||||
}
|
||||
|
||||
@Override public <T extends FieldData> T cache(Class<T> type, IndexReader reader, String fieldName) throws IOException {
|
||||
return FieldData.load(type, reader, fieldName);
|
||||
}
|
||||
|
||||
@Override public FieldData cache(FieldData.Type type, IndexReader reader, String fieldName) throws IOException {
|
||||
@Override public FieldData cache(FieldDataType type, IndexReader reader, String fieldName) throws IOException {
|
||||
return FieldData.load(type, reader, fieldName);
|
||||
}
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ import org.elasticsearch.index.AbstractIndexComponent;
|
|||
import org.elasticsearch.index.Index;
|
||||
import org.elasticsearch.index.cache.field.data.FieldDataCache;
|
||||
import org.elasticsearch.index.field.data.FieldData;
|
||||
import org.elasticsearch.index.field.data.FieldDataType;
|
||||
import org.elasticsearch.index.settings.IndexSettings;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -69,15 +70,7 @@ public abstract class AbstractConcurrentMapFieldDataCache extends AbstractIndexC
|
|||
// nothing to do here...
|
||||
}
|
||||
|
||||
@Override public FieldData cache(FieldData.Type type, IndexReader reader, String fieldName) throws IOException {
|
||||
return cache(type.fieldDataClass(), reader, fieldName);
|
||||
}
|
||||
|
||||
protected ConcurrentMap<String, FieldData> buildFieldDataMap() {
|
||||
return ConcurrentCollections.newConcurrentMap();
|
||||
}
|
||||
|
||||
@Override public <T extends FieldData> T cache(Class<T> type, IndexReader reader, String fieldName) throws IOException {
|
||||
@Override public FieldData cache(FieldDataType type, IndexReader reader, String fieldName) throws IOException {
|
||||
ConcurrentMap<String, FieldData> fieldDataCache = cache.get(reader.getFieldCacheKey());
|
||||
if (fieldDataCache == null) {
|
||||
synchronized (creationMutex) {
|
||||
|
@ -88,10 +81,10 @@ public abstract class AbstractConcurrentMapFieldDataCache extends AbstractIndexC
|
|||
}
|
||||
}
|
||||
}
|
||||
T fieldData = (T) fieldDataCache.get(fieldName);
|
||||
FieldData fieldData = (FieldData) fieldDataCache.get(fieldName);
|
||||
if (fieldData == null) {
|
||||
synchronized (fieldDataCache) {
|
||||
fieldData = (T) fieldDataCache.get(fieldName);
|
||||
fieldData = fieldDataCache.get(fieldName);
|
||||
if (fieldData == null) {
|
||||
fieldData = FieldData.load(type, reader, fieldName);
|
||||
fieldDataCache.put(fieldName, fieldData);
|
||||
|
@ -100,4 +93,8 @@ public abstract class AbstractConcurrentMapFieldDataCache extends AbstractIndexC
|
|||
}
|
||||
return fieldData;
|
||||
}
|
||||
|
||||
protected ConcurrentMap<String, FieldData> buildFieldDataMap() {
|
||||
return ConcurrentCollections.newConcurrentMap();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ public abstract class DocFieldData<T extends FieldData> {
|
|||
return stringValue();
|
||||
}
|
||||
|
||||
public FieldData.Type getType() {
|
||||
public FieldDataType getType() {
|
||||
return fieldData.type();
|
||||
}
|
||||
|
||||
|
|
|
@ -21,22 +21,8 @@ package org.elasticsearch.index.field.data;
|
|||
|
||||
import org.apache.lucene.index.IndexReader;
|
||||
import org.apache.lucene.search.FieldComparator;
|
||||
import org.apache.lucene.search.FieldComparatorSource;
|
||||
import org.elasticsearch.ElasticSearchIllegalArgumentException;
|
||||
import org.elasticsearch.common.thread.ThreadLocals;
|
||||
import org.elasticsearch.index.cache.field.data.FieldDataCache;
|
||||
import org.elasticsearch.index.field.data.doubles.DoubleFieldData;
|
||||
import org.elasticsearch.index.field.data.doubles.DoubleFieldDataComparator;
|
||||
import org.elasticsearch.index.field.data.floats.FloatFieldData;
|
||||
import org.elasticsearch.index.field.data.floats.FloatFieldDataComparator;
|
||||
import org.elasticsearch.index.field.data.ints.IntFieldData;
|
||||
import org.elasticsearch.index.field.data.ints.IntFieldDataComparator;
|
||||
import org.elasticsearch.index.field.data.longs.LongFieldData;
|
||||
import org.elasticsearch.index.field.data.longs.LongFieldDataComparator;
|
||||
import org.elasticsearch.index.field.data.shorts.ShortFieldData;
|
||||
import org.elasticsearch.index.field.data.shorts.ShortFieldDataComparator;
|
||||
import org.elasticsearch.index.field.data.strings.StringFieldData;
|
||||
import org.elasticsearch.index.field.data.strings.StringOrdValFieldDataComparator;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
@ -47,112 +33,6 @@ import java.io.IOException;
|
|||
// TODO Optimize the order (both int[] and int[][] when they are sparse, create an Order abstraction)
|
||||
public abstract class FieldData<Doc extends DocFieldData> {
|
||||
|
||||
public static enum Type {
|
||||
STRING() {
|
||||
|
||||
@Override public Class<? extends FieldData> fieldDataClass() {
|
||||
return StringFieldData.class;
|
||||
}
|
||||
|
||||
@Override public boolean isNumeric() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override public FieldComparatorSource newFieldComparatorSource(final FieldDataCache cache) {
|
||||
return new FieldComparatorSource() {
|
||||
@Override public FieldComparator newComparator(String fieldname, int numHits, int sortPos, boolean reversed) throws IOException {
|
||||
return new StringOrdValFieldDataComparator(numHits, fieldname, sortPos, reversed, cache);
|
||||
}
|
||||
};
|
||||
}},
|
||||
SHORT() {
|
||||
@Override public Class<? extends FieldData> fieldDataClass() {
|
||||
return ShortFieldData.class;
|
||||
}
|
||||
|
||||
@Override public boolean isNumeric() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override public FieldComparatorSource newFieldComparatorSource(final FieldDataCache cache) {
|
||||
return new FieldComparatorSource() {
|
||||
@Override public FieldComparator newComparator(String fieldname, int numHits, int sortPos, boolean reversed) throws IOException {
|
||||
return new ShortFieldDataComparator(numHits, fieldname, cache);
|
||||
}
|
||||
};
|
||||
}},
|
||||
INT() {
|
||||
@Override public Class<? extends FieldData> fieldDataClass() {
|
||||
return IntFieldData.class;
|
||||
}
|
||||
|
||||
@Override public boolean isNumeric() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override public FieldComparatorSource newFieldComparatorSource(final FieldDataCache cache) {
|
||||
return new FieldComparatorSource() {
|
||||
@Override public FieldComparator newComparator(String fieldname, int numHits, int sortPos, boolean reversed) throws IOException {
|
||||
return new IntFieldDataComparator(numHits, fieldname, cache);
|
||||
}
|
||||
};
|
||||
}},
|
||||
LONG() {
|
||||
@Override public Class<? extends FieldData> fieldDataClass() {
|
||||
return LongFieldData.class;
|
||||
}
|
||||
|
||||
@Override public boolean isNumeric() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override public FieldComparatorSource newFieldComparatorSource(final FieldDataCache cache) {
|
||||
return new FieldComparatorSource() {
|
||||
@Override public FieldComparator newComparator(String fieldname, int numHits, int sortPos, boolean reversed) throws IOException {
|
||||
return new LongFieldDataComparator(numHits, fieldname, cache);
|
||||
}
|
||||
};
|
||||
}},
|
||||
FLOAT() {
|
||||
@Override public Class<? extends FieldData> fieldDataClass() {
|
||||
return FloatFieldData.class;
|
||||
}
|
||||
|
||||
@Override public boolean isNumeric() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override public FieldComparatorSource newFieldComparatorSource(final FieldDataCache cache) {
|
||||
return new FieldComparatorSource() {
|
||||
@Override public FieldComparator newComparator(String fieldname, int numHits, int sortPos, boolean reversed) throws IOException {
|
||||
return new FloatFieldDataComparator(numHits, fieldname, cache);
|
||||
}
|
||||
};
|
||||
}},
|
||||
DOUBLE() {
|
||||
@Override public Class<? extends FieldData> fieldDataClass() {
|
||||
return DoubleFieldData.class;
|
||||
}
|
||||
|
||||
@Override public boolean isNumeric() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override public FieldComparatorSource newFieldComparatorSource(final FieldDataCache cache) {
|
||||
return new FieldComparatorSource() {
|
||||
@Override public FieldComparator newComparator(String fieldname, int numHits, int sortPos, boolean reversed) throws IOException {
|
||||
return new DoubleFieldDataComparator(numHits, fieldname, cache);
|
||||
}
|
||||
};
|
||||
}};
|
||||
|
||||
public abstract Class<? extends FieldData> fieldDataClass();
|
||||
|
||||
public abstract boolean isNumeric();
|
||||
|
||||
public abstract FieldComparatorSource newFieldComparatorSource(FieldDataCache cache);
|
||||
}
|
||||
|
||||
private final ThreadLocal<ThreadLocals.CleanableValue<Doc>> cachedDocFieldData = new ThreadLocal<ThreadLocals.CleanableValue<Doc>>() {
|
||||
@Override protected ThreadLocals.CleanableValue<Doc> initialValue() {
|
||||
return new ThreadLocals.CleanableValue<Doc>(createFieldData());
|
||||
|
@ -207,29 +87,11 @@ public abstract class FieldData<Doc extends DocFieldData> {
|
|||
/**
|
||||
* The type of this field data.
|
||||
*/
|
||||
public abstract Type type();
|
||||
public abstract FieldDataType type();
|
||||
|
||||
public abstract FieldComparator newComparator(FieldDataCache fieldDataCache, int numHits, String field, int sortPos, boolean reversed);
|
||||
|
||||
public static FieldData load(Type type, IndexReader reader, String fieldName) throws IOException {
|
||||
return load(type.fieldDataClass(), reader, fieldName);
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public static <T extends FieldData> T load(Class<T> type, IndexReader reader, String fieldName) throws IOException {
|
||||
if (type == StringFieldData.class) {
|
||||
return (T) StringFieldData.load(reader, fieldName);
|
||||
} else if (type == IntFieldData.class) {
|
||||
return (T) IntFieldData.load(reader, fieldName);
|
||||
} else if (type == LongFieldData.class) {
|
||||
return (T) LongFieldData.load(reader, fieldName);
|
||||
} else if (type == FloatFieldData.class) {
|
||||
return (T) FloatFieldData.load(reader, fieldName);
|
||||
} else if (type == DoubleFieldData.class) {
|
||||
return (T) DoubleFieldData.load(reader, fieldName);
|
||||
} else if (type == ShortFieldData.class) {
|
||||
return (T) ShortFieldData.load(reader, fieldName);
|
||||
}
|
||||
throw new ElasticSearchIllegalArgumentException("No support for type [" + type + "] to load field data");
|
||||
public static FieldData load(FieldDataType type, IndexReader reader, String fieldName) throws IOException {
|
||||
return type.load(reader, fieldName);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
* Licensed to Elastic Search and Shay Banon under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. Elastic Search licenses this
|
||||
* file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.elasticsearch.index.field.data;
|
||||
|
||||
import org.apache.lucene.index.IndexReader;
|
||||
import org.apache.lucene.search.FieldComparatorSource;
|
||||
import org.elasticsearch.index.cache.field.data.FieldDataCache;
|
||||
import org.elasticsearch.index.field.data.doubles.DoubleFieldDataType;
|
||||
import org.elasticsearch.index.field.data.floats.FloatFieldDataType;
|
||||
import org.elasticsearch.index.field.data.ints.IntFieldDataType;
|
||||
import org.elasticsearch.index.field.data.longs.LongFieldDataType;
|
||||
import org.elasticsearch.index.field.data.shorts.ShortFieldDataType;
|
||||
import org.elasticsearch.index.field.data.strings.StringFieldDataType;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* @author kimchy (shay.banon)
|
||||
*/
|
||||
public interface FieldDataType<T extends FieldData> {
|
||||
|
||||
public static final class DefaultTypes {
|
||||
public static final StringFieldDataType STRING = new StringFieldDataType();
|
||||
public static final ShortFieldDataType SHORT = new ShortFieldDataType();
|
||||
public static final IntFieldDataType INT = new IntFieldDataType();
|
||||
public static final LongFieldDataType LONG = new LongFieldDataType();
|
||||
public static final FloatFieldDataType FLOAT = new FloatFieldDataType();
|
||||
public static final DoubleFieldDataType DOUBLE = new DoubleFieldDataType();
|
||||
}
|
||||
|
||||
Class<T> fieldDataClass();
|
||||
|
||||
FieldComparatorSource newFieldComparatorSource(FieldDataCache cache);
|
||||
|
||||
T load(IndexReader reader, String fieldName) throws IOException;
|
||||
}
|
|
@ -24,6 +24,7 @@ import org.apache.lucene.search.FieldCache;
|
|||
import org.apache.lucene.search.FieldComparator;
|
||||
import org.elasticsearch.common.trove.TDoubleArrayList;
|
||||
import org.elasticsearch.index.cache.field.data.FieldDataCache;
|
||||
import org.elasticsearch.index.field.data.FieldDataType;
|
||||
import org.elasticsearch.index.field.data.NumericFieldData;
|
||||
import org.elasticsearch.index.field.data.support.FieldDataLoader;
|
||||
|
||||
|
@ -93,8 +94,8 @@ public abstract class DoubleFieldData extends NumericFieldData<DoubleDocFieldDat
|
|||
return value(docId);
|
||||
}
|
||||
|
||||
@Override public Type type() {
|
||||
return Type.DOUBLE;
|
||||
@Override public FieldDataType type() {
|
||||
return FieldDataType.DefaultTypes.DOUBLE;
|
||||
}
|
||||
|
||||
public void forEachValue(ValueProc proc) {
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
package org.elasticsearch.index.field.data.doubles;
|
||||
|
||||
import org.elasticsearch.index.cache.field.data.FieldDataCache;
|
||||
import org.elasticsearch.index.field.data.FieldData;
|
||||
import org.elasticsearch.index.field.data.FieldDataType;
|
||||
import org.elasticsearch.index.field.data.support.NumericFieldDataComparator;
|
||||
|
||||
/**
|
||||
|
@ -37,8 +37,8 @@ public class DoubleFieldDataComparator extends NumericFieldDataComparator {
|
|||
values = new double[numHits];
|
||||
}
|
||||
|
||||
@Override public FieldData.Type fieldDataType() {
|
||||
return FieldData.Type.DOUBLE;
|
||||
@Override public FieldDataType fieldDataType() {
|
||||
return FieldDataType.DefaultTypes.DOUBLE;
|
||||
}
|
||||
|
||||
@Override public int compare(int slot1, int slot2) {
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* Licensed to Elastic Search and Shay Banon under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. Elastic Search licenses this
|
||||
* file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.elasticsearch.index.field.data.doubles;
|
||||
|
||||
import org.apache.lucene.index.IndexReader;
|
||||
import org.apache.lucene.search.FieldComparator;
|
||||
import org.apache.lucene.search.FieldComparatorSource;
|
||||
import org.elasticsearch.index.cache.field.data.FieldDataCache;
|
||||
import org.elasticsearch.index.field.data.FieldDataType;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* @author kimchy (shay.banon)
|
||||
*/
|
||||
public class DoubleFieldDataType implements FieldDataType<DoubleFieldData> {
|
||||
|
||||
@Override public Class<DoubleFieldData> fieldDataClass() {
|
||||
return DoubleFieldData.class;
|
||||
}
|
||||
|
||||
@Override public FieldComparatorSource newFieldComparatorSource(final FieldDataCache cache) {
|
||||
return new FieldComparatorSource() {
|
||||
@Override public FieldComparator newComparator(String fieldname, int numHits, int sortPos, boolean reversed) throws IOException {
|
||||
return new DoubleFieldDataComparator(numHits, fieldname, cache);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override public DoubleFieldData load(IndexReader reader, String fieldName) throws IOException {
|
||||
return DoubleFieldData.load(reader, fieldName);
|
||||
}
|
||||
}
|
|
@ -24,6 +24,7 @@ import org.apache.lucene.search.FieldCache;
|
|||
import org.apache.lucene.search.FieldComparator;
|
||||
import org.elasticsearch.common.trove.TFloatArrayList;
|
||||
import org.elasticsearch.index.cache.field.data.FieldDataCache;
|
||||
import org.elasticsearch.index.field.data.FieldDataType;
|
||||
import org.elasticsearch.index.field.data.NumericFieldData;
|
||||
import org.elasticsearch.index.field.data.support.FieldDataLoader;
|
||||
|
||||
|
@ -93,8 +94,8 @@ public abstract class FloatFieldData extends NumericFieldData<FloatDocFieldData>
|
|||
return (double) value(docId);
|
||||
}
|
||||
|
||||
@Override public Type type() {
|
||||
return Type.FLOAT;
|
||||
@Override public FieldDataType type() {
|
||||
return FieldDataType.DefaultTypes.FLOAT;
|
||||
}
|
||||
|
||||
public void forEachValue(ValueProc proc) {
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
package org.elasticsearch.index.field.data.floats;
|
||||
|
||||
import org.elasticsearch.index.cache.field.data.FieldDataCache;
|
||||
import org.elasticsearch.index.field.data.FieldData;
|
||||
import org.elasticsearch.index.field.data.FieldDataType;
|
||||
import org.elasticsearch.index.field.data.support.NumericFieldDataComparator;
|
||||
|
||||
/**
|
||||
|
@ -37,8 +37,8 @@ public class FloatFieldDataComparator extends NumericFieldDataComparator {
|
|||
values = new float[numHits];
|
||||
}
|
||||
|
||||
@Override public FieldData.Type fieldDataType() {
|
||||
return FieldData.Type.FLOAT;
|
||||
@Override public FieldDataType fieldDataType() {
|
||||
return FieldDataType.DefaultTypes.FLOAT;
|
||||
}
|
||||
|
||||
@Override public int compare(int slot1, int slot2) {
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* Licensed to Elastic Search and Shay Banon under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. Elastic Search licenses this
|
||||
* file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.elasticsearch.index.field.data.floats;
|
||||
|
||||
import org.apache.lucene.index.IndexReader;
|
||||
import org.apache.lucene.search.FieldComparator;
|
||||
import org.apache.lucene.search.FieldComparatorSource;
|
||||
import org.elasticsearch.index.cache.field.data.FieldDataCache;
|
||||
import org.elasticsearch.index.field.data.FieldDataType;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* @author kimchy (shay.banon)
|
||||
*/
|
||||
public class FloatFieldDataType implements FieldDataType<FloatFieldData> {
|
||||
|
||||
@Override public Class<FloatFieldData> fieldDataClass() {
|
||||
return FloatFieldData.class;
|
||||
}
|
||||
|
||||
@Override public FieldComparatorSource newFieldComparatorSource(final FieldDataCache cache) {
|
||||
return new FieldComparatorSource() {
|
||||
@Override public FieldComparator newComparator(String fieldname, int numHits, int sortPos, boolean reversed) throws IOException {
|
||||
return new FloatFieldDataComparator(numHits, fieldname, cache);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override public FloatFieldData load(IndexReader reader, String fieldName) throws IOException {
|
||||
return FloatFieldData.load(reader, fieldName);
|
||||
}
|
||||
}
|
|
@ -24,6 +24,7 @@ import org.apache.lucene.search.FieldCache;
|
|||
import org.apache.lucene.search.FieldComparator;
|
||||
import org.elasticsearch.common.trove.TIntArrayList;
|
||||
import org.elasticsearch.index.cache.field.data.FieldDataCache;
|
||||
import org.elasticsearch.index.field.data.FieldDataType;
|
||||
import org.elasticsearch.index.field.data.NumericFieldData;
|
||||
import org.elasticsearch.index.field.data.support.FieldDataLoader;
|
||||
|
||||
|
@ -93,8 +94,8 @@ public abstract class IntFieldData extends NumericFieldData<IntDocFieldData> {
|
|||
return (double) value(docId);
|
||||
}
|
||||
|
||||
@Override public Type type() {
|
||||
return Type.INT;
|
||||
@Override public FieldDataType type() {
|
||||
return FieldDataType.DefaultTypes.INT;
|
||||
}
|
||||
|
||||
public void forEachValue(ValueProc proc) {
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
package org.elasticsearch.index.field.data.ints;
|
||||
|
||||
import org.elasticsearch.index.cache.field.data.FieldDataCache;
|
||||
import org.elasticsearch.index.field.data.FieldData;
|
||||
import org.elasticsearch.index.field.data.FieldDataType;
|
||||
import org.elasticsearch.index.field.data.support.NumericFieldDataComparator;
|
||||
|
||||
/**
|
||||
|
@ -38,8 +38,8 @@ public class IntFieldDataComparator extends NumericFieldDataComparator {
|
|||
values = new int[numHits];
|
||||
}
|
||||
|
||||
@Override public FieldData.Type fieldDataType() {
|
||||
return FieldData.Type.INT;
|
||||
@Override public FieldDataType fieldDataType() {
|
||||
return FieldDataType.DefaultTypes.INT;
|
||||
}
|
||||
|
||||
@Override public int compare(int slot1, int slot2) {
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* Licensed to Elastic Search and Shay Banon under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. Elastic Search licenses this
|
||||
* file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.elasticsearch.index.field.data.ints;
|
||||
|
||||
import org.apache.lucene.index.IndexReader;
|
||||
import org.apache.lucene.search.FieldComparator;
|
||||
import org.apache.lucene.search.FieldComparatorSource;
|
||||
import org.elasticsearch.index.cache.field.data.FieldDataCache;
|
||||
import org.elasticsearch.index.field.data.FieldDataType;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* @author kimchy (shay.banon)
|
||||
*/
|
||||
public class IntFieldDataType implements FieldDataType<IntFieldData> {
|
||||
|
||||
@Override public Class<IntFieldData> fieldDataClass() {
|
||||
return IntFieldData.class;
|
||||
}
|
||||
|
||||
@Override public FieldComparatorSource newFieldComparatorSource(final FieldDataCache cache) {
|
||||
return new FieldComparatorSource() {
|
||||
@Override public FieldComparator newComparator(String fieldname, int numHits, int sortPos, boolean reversed) throws IOException {
|
||||
return new IntFieldDataComparator(numHits, fieldname, cache);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override public IntFieldData load(IndexReader reader, String fieldName) throws IOException {
|
||||
return IntFieldData.load(reader, fieldName);
|
||||
}
|
||||
}
|
|
@ -26,6 +26,7 @@ import org.elasticsearch.common.joda.time.MutableDateTime;
|
|||
import org.elasticsearch.common.thread.ThreadLocals;
|
||||
import org.elasticsearch.common.trove.TLongArrayList;
|
||||
import org.elasticsearch.index.cache.field.data.FieldDataCache;
|
||||
import org.elasticsearch.index.field.data.FieldDataType;
|
||||
import org.elasticsearch.index.field.data.NumericFieldData;
|
||||
import org.elasticsearch.index.field.data.support.FieldDataLoader;
|
||||
|
||||
|
@ -110,8 +111,8 @@ public abstract class LongFieldData extends NumericFieldData<LongDocFieldData> {
|
|||
return (double) value(docId);
|
||||
}
|
||||
|
||||
@Override public Type type() {
|
||||
return Type.LONG;
|
||||
@Override public FieldDataType type() {
|
||||
return FieldDataType.DefaultTypes.LONG;
|
||||
}
|
||||
|
||||
public void forEachValue(ValueProc proc) {
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
package org.elasticsearch.index.field.data.longs;
|
||||
|
||||
import org.elasticsearch.index.cache.field.data.FieldDataCache;
|
||||
import org.elasticsearch.index.field.data.FieldData;
|
||||
import org.elasticsearch.index.field.data.FieldDataType;
|
||||
import org.elasticsearch.index.field.data.support.NumericFieldDataComparator;
|
||||
|
||||
/**
|
||||
|
@ -37,8 +37,8 @@ public class LongFieldDataComparator extends NumericFieldDataComparator {
|
|||
values = new long[numHits];
|
||||
}
|
||||
|
||||
@Override public FieldData.Type fieldDataType() {
|
||||
return FieldData.Type.LONG;
|
||||
@Override public FieldDataType fieldDataType() {
|
||||
return FieldDataType.DefaultTypes.LONG;
|
||||
}
|
||||
|
||||
@Override public int compare(int slot1, int slot2) {
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* Licensed to Elastic Search and Shay Banon under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. Elastic Search licenses this
|
||||
* file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.elasticsearch.index.field.data.longs;
|
||||
|
||||
import org.apache.lucene.index.IndexReader;
|
||||
import org.apache.lucene.search.FieldComparator;
|
||||
import org.apache.lucene.search.FieldComparatorSource;
|
||||
import org.elasticsearch.index.cache.field.data.FieldDataCache;
|
||||
import org.elasticsearch.index.field.data.FieldDataType;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* @author kimchy (shay.banon)
|
||||
*/
|
||||
public class LongFieldDataType implements FieldDataType<LongFieldData> {
|
||||
|
||||
@Override public Class<LongFieldData> fieldDataClass() {
|
||||
return LongFieldData.class;
|
||||
}
|
||||
|
||||
@Override public FieldComparatorSource newFieldComparatorSource(final FieldDataCache cache) {
|
||||
return new FieldComparatorSource() {
|
||||
@Override public FieldComparator newComparator(String fieldname, int numHits, int sortPos, boolean reversed) throws IOException {
|
||||
return new LongFieldDataComparator(numHits, fieldname, cache);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override public LongFieldData load(IndexReader reader, String fieldName) throws IOException {
|
||||
return LongFieldData.load(reader, fieldName);
|
||||
}
|
||||
}
|
|
@ -24,6 +24,7 @@ import org.apache.lucene.search.FieldCache;
|
|||
import org.apache.lucene.search.FieldComparator;
|
||||
import org.elasticsearch.common.trove.TShortArrayList;
|
||||
import org.elasticsearch.index.cache.field.data.FieldDataCache;
|
||||
import org.elasticsearch.index.field.data.FieldDataType;
|
||||
import org.elasticsearch.index.field.data.NumericFieldData;
|
||||
import org.elasticsearch.index.field.data.support.FieldDataLoader;
|
||||
|
||||
|
@ -93,8 +94,8 @@ public abstract class ShortFieldData extends NumericFieldData<ShortDocFieldData>
|
|||
return (double) value(docId);
|
||||
}
|
||||
|
||||
@Override public Type type() {
|
||||
return Type.SHORT;
|
||||
@Override public FieldDataType type() {
|
||||
return FieldDataType.DefaultTypes.SHORT;
|
||||
}
|
||||
|
||||
public void forEachValue(ValueProc proc) {
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
package org.elasticsearch.index.field.data.shorts;
|
||||
|
||||
import org.elasticsearch.index.cache.field.data.FieldDataCache;
|
||||
import org.elasticsearch.index.field.data.FieldData;
|
||||
import org.elasticsearch.index.field.data.FieldDataType;
|
||||
import org.elasticsearch.index.field.data.support.NumericFieldDataComparator;
|
||||
|
||||
/**
|
||||
|
@ -37,8 +37,8 @@ public class ShortFieldDataComparator extends NumericFieldDataComparator {
|
|||
values = new short[numHits];
|
||||
}
|
||||
|
||||
@Override public FieldData.Type fieldDataType() {
|
||||
return FieldData.Type.SHORT;
|
||||
@Override public FieldDataType fieldDataType() {
|
||||
return FieldDataType.DefaultTypes.SHORT;
|
||||
}
|
||||
|
||||
@Override public int compare(int slot1, int slot2) {
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* Licensed to Elastic Search and Shay Banon under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. Elastic Search licenses this
|
||||
* file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.elasticsearch.index.field.data.shorts;
|
||||
|
||||
import org.apache.lucene.index.IndexReader;
|
||||
import org.apache.lucene.search.FieldComparator;
|
||||
import org.apache.lucene.search.FieldComparatorSource;
|
||||
import org.elasticsearch.index.cache.field.data.FieldDataCache;
|
||||
import org.elasticsearch.index.field.data.FieldDataType;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* @author kimchy (shay.banon)
|
||||
*/
|
||||
public class ShortFieldDataType implements FieldDataType<ShortFieldData> {
|
||||
|
||||
@Override public Class<ShortFieldData> fieldDataClass() {
|
||||
return ShortFieldData.class;
|
||||
}
|
||||
|
||||
@Override public FieldComparatorSource newFieldComparatorSource(final FieldDataCache cache) {
|
||||
return new FieldComparatorSource() {
|
||||
@Override public FieldComparator newComparator(String fieldname, int numHits, int sortPos, boolean reversed) throws IOException {
|
||||
return new ShortFieldDataComparator(numHits, fieldname, cache);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override public ShortFieldData load(IndexReader reader, String fieldName) throws IOException {
|
||||
return ShortFieldData.load(reader, fieldName);
|
||||
}
|
||||
}
|
|
@ -21,6 +21,7 @@ package org.elasticsearch.index.field.data.strings;
|
|||
|
||||
import org.apache.lucene.index.IndexReader;
|
||||
import org.elasticsearch.index.field.data.FieldData;
|
||||
import org.elasticsearch.index.field.data.FieldDataType;
|
||||
import org.elasticsearch.index.field.data.support.FieldDataLoader;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -54,8 +55,8 @@ public abstract class StringFieldData extends FieldData<StringDocFieldData> {
|
|||
return new StringDocFieldData(this);
|
||||
}
|
||||
|
||||
@Override public Type type() {
|
||||
return Type.STRING;
|
||||
@Override public FieldDataType type() {
|
||||
return FieldDataType.DefaultTypes.STRING;
|
||||
}
|
||||
|
||||
@Override public void forEachValue(StringValueProc proc) {
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* Licensed to Elastic Search and Shay Banon under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. Elastic Search licenses this
|
||||
* file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.elasticsearch.index.field.data.strings;
|
||||
|
||||
import org.apache.lucene.index.IndexReader;
|
||||
import org.apache.lucene.search.FieldComparator;
|
||||
import org.apache.lucene.search.FieldComparatorSource;
|
||||
import org.elasticsearch.index.cache.field.data.FieldDataCache;
|
||||
import org.elasticsearch.index.field.data.FieldDataType;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* @author kimchy (shay.banon)
|
||||
*/
|
||||
public class StringFieldDataType implements FieldDataType<StringFieldData> {
|
||||
|
||||
@Override public Class<StringFieldData> fieldDataClass() {
|
||||
return StringFieldData.class;
|
||||
}
|
||||
|
||||
@Override public FieldComparatorSource newFieldComparatorSource(final FieldDataCache cache) {
|
||||
return new FieldComparatorSource() {
|
||||
@Override public FieldComparator newComparator(String fieldname, int numHits, int sortPos, boolean reversed) throws IOException {
|
||||
return new StringOrdValFieldDataComparator(numHits, fieldname, sortPos, reversed, cache);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override public StringFieldData load(IndexReader reader, String fieldName) throws IOException {
|
||||
return StringFieldData.load(reader, fieldName);
|
||||
}
|
||||
}
|
|
@ -23,6 +23,7 @@ import org.apache.lucene.index.IndexReader;
|
|||
import org.apache.lucene.search.FieldComparator;
|
||||
import org.elasticsearch.index.cache.field.data.FieldDataCache;
|
||||
import org.elasticsearch.index.field.data.FieldData;
|
||||
import org.elasticsearch.index.field.data.FieldDataType;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
@ -140,7 +141,7 @@ public class StringOrdValFieldDataComparator extends FieldComparator {
|
|||
}
|
||||
|
||||
@Override public void setNextReader(IndexReader reader, int docBase) throws IOException {
|
||||
FieldData cleanFieldData = fieldDataCache.cache(FieldData.Type.STRING, reader, field);
|
||||
FieldData cleanFieldData = fieldDataCache.cache(FieldDataType.DefaultTypes.STRING, reader, field);
|
||||
if (cleanFieldData instanceof MultiValueStringFieldData) {
|
||||
throw new IOException("Can't sort on string types with more than one value per doc, or more than one token per field");
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ import org.apache.lucene.index.IndexReader;
|
|||
import org.apache.lucene.search.FieldComparator;
|
||||
import org.elasticsearch.index.cache.field.data.FieldDataCache;
|
||||
import org.elasticsearch.index.field.data.FieldData;
|
||||
import org.elasticsearch.index.field.data.FieldDataType;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
@ -81,7 +82,7 @@ public class StringValFieldDataComparator extends FieldComparator {
|
|||
}
|
||||
|
||||
@Override public void setNextReader(IndexReader reader, int docBase) throws IOException {
|
||||
currentFieldData = fieldDataCache.cache(FieldData.Type.STRING, reader, fieldName);
|
||||
currentFieldData = fieldDataCache.cache(FieldDataType.DefaultTypes.STRING, reader, fieldName);
|
||||
}
|
||||
|
||||
@Override public void setBottom(final int bottom) {
|
||||
|
|
|
@ -22,7 +22,7 @@ package org.elasticsearch.index.field.data.support;
|
|||
import org.apache.lucene.index.IndexReader;
|
||||
import org.apache.lucene.search.FieldComparator;
|
||||
import org.elasticsearch.index.cache.field.data.FieldDataCache;
|
||||
import org.elasticsearch.index.field.data.FieldData;
|
||||
import org.elasticsearch.index.field.data.FieldDataType;
|
||||
import org.elasticsearch.index.field.data.NumericFieldData;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -43,7 +43,7 @@ public abstract class NumericFieldDataComparator extends FieldComparator {
|
|||
this.fieldDataCache = fieldDataCache;
|
||||
}
|
||||
|
||||
public abstract FieldData.Type fieldDataType();
|
||||
public abstract FieldDataType fieldDataType();
|
||||
|
||||
@Override public void setNextReader(IndexReader reader, int docBase) throws IOException {
|
||||
currentFieldData = (NumericFieldData) fieldDataCache.cache(fieldDataType(), reader, fieldName);
|
||||
|
|
|
@ -27,7 +27,7 @@ import org.apache.lucene.search.Filter;
|
|||
import org.apache.lucene.search.Query;
|
||||
import org.elasticsearch.common.util.concurrent.Immutable;
|
||||
import org.elasticsearch.common.util.concurrent.ThreadSafe;
|
||||
import org.elasticsearch.index.field.data.FieldData;
|
||||
import org.elasticsearch.index.field.data.FieldDataType;
|
||||
|
||||
/**
|
||||
* @author kimchy (Shay Banon)
|
||||
|
@ -163,5 +163,5 @@ public interface FieldMapper<T> {
|
|||
*/
|
||||
Filter rangeFilter(String lowerTerm, String upperTerm, boolean includeLower, boolean includeUpper);
|
||||
|
||||
FieldData.Type fieldDataType();
|
||||
FieldDataType fieldDataType();
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
|
|||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
import org.elasticsearch.index.analysis.NamedAnalyzer;
|
||||
import org.elasticsearch.index.analysis.NumericFloatAnalyzer;
|
||||
import org.elasticsearch.index.field.data.FieldData;
|
||||
import org.elasticsearch.index.field.data.FieldDataType;
|
||||
import org.elasticsearch.index.mapper.BoostFieldMapper;
|
||||
import org.elasticsearch.index.mapper.MergeMappingException;
|
||||
|
||||
|
@ -168,8 +168,8 @@ public class XContentBoostFieldMapper extends XContentNumberFieldMapper<Float> i
|
|||
return value;
|
||||
}
|
||||
|
||||
@Override public FieldData.Type fieldDataType() {
|
||||
return FieldData.Type.FLOAT;
|
||||
@Override public FieldDataType fieldDataType() {
|
||||
return FieldDataType.DefaultTypes.FLOAT;
|
||||
}
|
||||
|
||||
@Override protected String contentType() {
|
||||
|
|
|
@ -34,7 +34,7 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
|
|||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
import org.elasticsearch.index.analysis.NamedAnalyzer;
|
||||
import org.elasticsearch.index.analysis.NumericDateAnalyzer;
|
||||
import org.elasticsearch.index.field.data.FieldData;
|
||||
import org.elasticsearch.index.field.data.FieldDataType;
|
||||
import org.elasticsearch.index.mapper.MapperParsingException;
|
||||
import org.elasticsearch.index.mapper.MergeMappingException;
|
||||
|
||||
|
@ -202,8 +202,8 @@ public class XContentDateFieldMapper extends XContentNumberFieldMapper<Long> {
|
|||
return field;
|
||||
}
|
||||
|
||||
@Override public FieldData.Type fieldDataType() {
|
||||
return FieldData.Type.LONG;
|
||||
@Override public FieldDataType fieldDataType() {
|
||||
return FieldDataType.DefaultTypes.LONG;
|
||||
}
|
||||
|
||||
@Override protected String contentType() {
|
||||
|
|
|
@ -31,7 +31,7 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
|
|||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
import org.elasticsearch.index.analysis.NamedAnalyzer;
|
||||
import org.elasticsearch.index.analysis.NumericDoubleAnalyzer;
|
||||
import org.elasticsearch.index.field.data.FieldData;
|
||||
import org.elasticsearch.index.field.data.FieldDataType;
|
||||
import org.elasticsearch.index.mapper.MapperParsingException;
|
||||
import org.elasticsearch.index.mapper.MergeMappingException;
|
||||
|
||||
|
@ -184,8 +184,8 @@ public class XContentDoubleFieldMapper extends XContentNumberFieldMapper<Double>
|
|||
return field;
|
||||
}
|
||||
|
||||
@Override public FieldData.Type fieldDataType() {
|
||||
return FieldData.Type.DOUBLE;
|
||||
@Override public FieldDataType fieldDataType() {
|
||||
return FieldDataType.DefaultTypes.DOUBLE;
|
||||
}
|
||||
|
||||
@Override protected String contentType() {
|
||||
|
|
|
@ -28,7 +28,7 @@ import org.elasticsearch.common.lucene.Lucene;
|
|||
import org.elasticsearch.common.lucene.search.TermFilter;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.index.analysis.NamedAnalyzer;
|
||||
import org.elasticsearch.index.field.data.FieldData;
|
||||
import org.elasticsearch.index.field.data.FieldDataType;
|
||||
import org.elasticsearch.index.mapper.FieldMapper;
|
||||
import org.elasticsearch.index.mapper.FieldMapperListener;
|
||||
import org.elasticsearch.index.mapper.MapperParsingException;
|
||||
|
@ -384,8 +384,8 @@ public abstract class XContentFieldMapper<T> implements FieldMapper<T>, XContent
|
|||
}
|
||||
}
|
||||
|
||||
@Override public FieldData.Type fieldDataType() {
|
||||
return FieldData.Type.STRING;
|
||||
@Override public FieldDataType fieldDataType() {
|
||||
return FieldDataType.DefaultTypes.STRING;
|
||||
}
|
||||
|
||||
@Override public void toXContent(XContentBuilder builder, Params params) throws IOException {
|
||||
|
|
|
@ -32,7 +32,7 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
|
|||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
import org.elasticsearch.index.analysis.NamedAnalyzer;
|
||||
import org.elasticsearch.index.analysis.NumericFloatAnalyzer;
|
||||
import org.elasticsearch.index.field.data.FieldData;
|
||||
import org.elasticsearch.index.field.data.FieldDataType;
|
||||
import org.elasticsearch.index.mapper.MapperParsingException;
|
||||
import org.elasticsearch.index.mapper.MergeMappingException;
|
||||
|
||||
|
@ -183,8 +183,8 @@ public class XContentFloatFieldMapper extends XContentNumberFieldMapper<Float> {
|
|||
return field;
|
||||
}
|
||||
|
||||
@Override public FieldData.Type fieldDataType() {
|
||||
return FieldData.Type.FLOAT;
|
||||
@Override public FieldDataType fieldDataType() {
|
||||
return FieldDataType.DefaultTypes.FLOAT;
|
||||
}
|
||||
|
||||
@Override protected String contentType() {
|
||||
|
|
|
@ -32,7 +32,7 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
|
|||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
import org.elasticsearch.index.analysis.NamedAnalyzer;
|
||||
import org.elasticsearch.index.analysis.NumericIntegerAnalyzer;
|
||||
import org.elasticsearch.index.field.data.FieldData;
|
||||
import org.elasticsearch.index.field.data.FieldDataType;
|
||||
import org.elasticsearch.index.mapper.MapperParsingException;
|
||||
import org.elasticsearch.index.mapper.MergeMappingException;
|
||||
|
||||
|
@ -183,8 +183,8 @@ public class XContentIntegerFieldMapper extends XContentNumberFieldMapper<Intege
|
|||
return field;
|
||||
}
|
||||
|
||||
@Override public FieldData.Type fieldDataType() {
|
||||
return FieldData.Type.INT;
|
||||
@Override public FieldDataType fieldDataType() {
|
||||
return FieldDataType.DefaultTypes.INT;
|
||||
}
|
||||
|
||||
@Override protected String contentType() {
|
||||
|
|
|
@ -32,7 +32,7 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
|
|||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
import org.elasticsearch.index.analysis.NamedAnalyzer;
|
||||
import org.elasticsearch.index.analysis.NumericLongAnalyzer;
|
||||
import org.elasticsearch.index.field.data.FieldData;
|
||||
import org.elasticsearch.index.field.data.FieldDataType;
|
||||
import org.elasticsearch.index.mapper.MapperParsingException;
|
||||
import org.elasticsearch.index.mapper.MergeMappingException;
|
||||
|
||||
|
@ -183,8 +183,8 @@ public class XContentLongFieldMapper extends XContentNumberFieldMapper<Long> {
|
|||
return field;
|
||||
}
|
||||
|
||||
@Override public FieldData.Type fieldDataType() {
|
||||
return FieldData.Type.LONG;
|
||||
@Override public FieldDataType fieldDataType() {
|
||||
return FieldDataType.DefaultTypes.LONG;
|
||||
}
|
||||
|
||||
@Override protected String contentType() {
|
||||
|
|
|
@ -30,7 +30,7 @@ import org.elasticsearch.common.thread.ThreadLocals;
|
|||
import org.elasticsearch.common.trove.TIntObjectHashMap;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.index.analysis.NamedAnalyzer;
|
||||
import org.elasticsearch.index.field.data.FieldData;
|
||||
import org.elasticsearch.index.field.data.FieldDataType;
|
||||
import org.elasticsearch.index.mapper.MergeMappingException;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -171,7 +171,7 @@ public abstract class XContentNumberFieldMapper<T extends Number> extends XConte
|
|||
builder.field("precision_step", precisionStep);
|
||||
}
|
||||
|
||||
@Override public abstract FieldData.Type fieldDataType();
|
||||
@Override public abstract FieldDataType fieldDataType();
|
||||
|
||||
/**
|
||||
* Removes a cached numeric token stream. The stream will be returned to the cahed once it is used
|
||||
|
|
|
@ -32,7 +32,7 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
|
|||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
import org.elasticsearch.index.analysis.NamedAnalyzer;
|
||||
import org.elasticsearch.index.analysis.NumericIntegerAnalyzer;
|
||||
import org.elasticsearch.index.field.data.FieldData;
|
||||
import org.elasticsearch.index.field.data.FieldDataType;
|
||||
import org.elasticsearch.index.mapper.MapperParsingException;
|
||||
import org.elasticsearch.index.mapper.MergeMappingException;
|
||||
|
||||
|
@ -183,8 +183,8 @@ public class XContentShortFieldMapper extends XContentNumberFieldMapper<Short> {
|
|||
return field;
|
||||
}
|
||||
|
||||
@Override public FieldData.Type fieldDataType() {
|
||||
return FieldData.Type.SHORT;
|
||||
@Override public FieldDataType fieldDataType() {
|
||||
return FieldDataType.DefaultTypes.SHORT;
|
||||
}
|
||||
|
||||
@Override protected String contentType() {
|
||||
|
|
|
@ -23,7 +23,7 @@ import org.apache.lucene.index.IndexReader;
|
|||
import org.elasticsearch.common.lucene.geo.GeoDistance;
|
||||
import org.elasticsearch.common.unit.DistanceUnit;
|
||||
import org.elasticsearch.index.cache.field.data.FieldDataCache;
|
||||
import org.elasticsearch.index.field.data.FieldData;
|
||||
import org.elasticsearch.index.field.data.FieldDataType;
|
||||
import org.elasticsearch.index.field.data.NumericFieldData;
|
||||
import org.elasticsearch.index.mapper.FieldMapper;
|
||||
import org.elasticsearch.index.mapper.MapperService;
|
||||
|
@ -56,7 +56,7 @@ public class GeoDistanceFacetCollector extends AbstractFacetCollector {
|
|||
|
||||
protected final FieldDataCache fieldDataCache;
|
||||
|
||||
protected final FieldData.Type fieldDataType;
|
||||
protected final FieldDataType fieldDataType;
|
||||
|
||||
protected NumericFieldData latFieldData;
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ package org.elasticsearch.search.facets.geodistance;
|
|||
import org.apache.lucene.index.IndexReader;
|
||||
import org.elasticsearch.common.lucene.geo.GeoDistance;
|
||||
import org.elasticsearch.common.unit.DistanceUnit;
|
||||
import org.elasticsearch.index.field.data.FieldData;
|
||||
import org.elasticsearch.index.field.data.FieldDataType;
|
||||
import org.elasticsearch.index.field.data.NumericFieldData;
|
||||
import org.elasticsearch.index.mapper.FieldMapper;
|
||||
import org.elasticsearch.search.facets.Facet;
|
||||
|
@ -40,7 +40,7 @@ public class ValueGeoDistanceFacetCollector extends GeoDistanceFacetCollector {
|
|||
|
||||
private final String indexValueFieldName;
|
||||
|
||||
private final FieldData.Type valueFieldDataType;
|
||||
private final FieldDataType valueFieldDataType;
|
||||
|
||||
private NumericFieldData valueFieldData;
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ import org.apache.lucene.index.IndexReader;
|
|||
import org.elasticsearch.common.trove.TLongDoubleHashMap;
|
||||
import org.elasticsearch.common.trove.TLongLongHashMap;
|
||||
import org.elasticsearch.index.cache.field.data.FieldDataCache;
|
||||
import org.elasticsearch.index.field.data.FieldData;
|
||||
import org.elasticsearch.index.field.data.FieldDataType;
|
||||
import org.elasticsearch.index.field.data.NumericFieldData;
|
||||
import org.elasticsearch.index.mapper.FieldMapper;
|
||||
import org.elasticsearch.index.mapper.MapperService;
|
||||
|
@ -52,7 +52,7 @@ public class HistogramFacetCollector extends AbstractFacetCollector {
|
|||
|
||||
private final FieldDataCache fieldDataCache;
|
||||
|
||||
private final FieldData.Type fieldDataType;
|
||||
private final FieldDataType fieldDataType;
|
||||
|
||||
private NumericFieldData fieldData;
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ import org.apache.lucene.index.IndexReader;
|
|||
import org.elasticsearch.common.trove.TLongDoubleHashMap;
|
||||
import org.elasticsearch.common.trove.TLongLongHashMap;
|
||||
import org.elasticsearch.index.cache.field.data.FieldDataCache;
|
||||
import org.elasticsearch.index.field.data.FieldData;
|
||||
import org.elasticsearch.index.field.data.FieldDataType;
|
||||
import org.elasticsearch.index.field.data.NumericFieldData;
|
||||
import org.elasticsearch.index.mapper.FieldMapper;
|
||||
import org.elasticsearch.index.mapper.MapperService;
|
||||
|
@ -53,10 +53,10 @@ public class KeyValueHistogramFacetCollector extends AbstractFacetCollector {
|
|||
|
||||
private final FieldDataCache fieldDataCache;
|
||||
|
||||
private final FieldData.Type keyFieldDataType;
|
||||
private final FieldDataType keyFieldDataType;
|
||||
private NumericFieldData keyFieldData;
|
||||
|
||||
private final FieldData.Type valueFieldDataType;
|
||||
private final FieldDataType valueFieldDataType;
|
||||
private NumericFieldData valueFieldData;
|
||||
|
||||
private final TLongLongHashMap counts = new TLongLongHashMap();
|
||||
|
|
|
@ -21,7 +21,7 @@ package org.elasticsearch.search.facets.range;
|
|||
|
||||
import org.apache.lucene.index.IndexReader;
|
||||
import org.elasticsearch.index.cache.field.data.FieldDataCache;
|
||||
import org.elasticsearch.index.field.data.FieldData;
|
||||
import org.elasticsearch.index.field.data.FieldDataType;
|
||||
import org.elasticsearch.index.field.data.NumericFieldData;
|
||||
import org.elasticsearch.index.mapper.FieldMapper;
|
||||
import org.elasticsearch.index.mapper.MapperService;
|
||||
|
@ -45,10 +45,10 @@ public class KeyValueRangeFacetCollector extends AbstractFacetCollector {
|
|||
|
||||
private final FieldDataCache fieldDataCache;
|
||||
|
||||
private final FieldData.Type keyFieldDataType;
|
||||
private final FieldDataType keyFieldDataType;
|
||||
private NumericFieldData keyFieldData;
|
||||
|
||||
private final FieldData.Type valueFieldDataType;
|
||||
private final FieldDataType valueFieldDataType;
|
||||
private NumericFieldData valueFieldData;
|
||||
|
||||
private final RangeFacet.Entry[] entries;
|
||||
|
|
|
@ -21,7 +21,7 @@ package org.elasticsearch.search.facets.range;
|
|||
|
||||
import org.apache.lucene.index.IndexReader;
|
||||
import org.elasticsearch.index.cache.field.data.FieldDataCache;
|
||||
import org.elasticsearch.index.field.data.FieldData;
|
||||
import org.elasticsearch.index.field.data.FieldDataType;
|
||||
import org.elasticsearch.index.field.data.NumericFieldData;
|
||||
import org.elasticsearch.index.mapper.MapperService;
|
||||
import org.elasticsearch.search.facets.Facet;
|
||||
|
@ -42,7 +42,7 @@ public class RangeFacetCollector extends AbstractFacetCollector {
|
|||
|
||||
private final FieldDataCache fieldDataCache;
|
||||
|
||||
private final FieldData.Type fieldDataType;
|
||||
private final FieldDataType fieldDataType;
|
||||
|
||||
private NumericFieldData fieldData;
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ package org.elasticsearch.search.facets.statistical;
|
|||
|
||||
import org.apache.lucene.index.IndexReader;
|
||||
import org.elasticsearch.index.cache.field.data.FieldDataCache;
|
||||
import org.elasticsearch.index.field.data.FieldData;
|
||||
import org.elasticsearch.index.field.data.FieldDataType;
|
||||
import org.elasticsearch.index.field.data.NumericFieldData;
|
||||
import org.elasticsearch.index.mapper.MapperService;
|
||||
import org.elasticsearch.search.facets.Facet;
|
||||
|
@ -42,7 +42,7 @@ public class StatisticalFacetCollector extends AbstractFacetCollector {
|
|||
|
||||
private final FieldDataCache fieldDataCache;
|
||||
|
||||
private final FieldData.Type fieldDataType;
|
||||
private final FieldDataType fieldDataType;
|
||||
|
||||
private NumericFieldData fieldData;
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ import org.elasticsearch.common.trove.TObjectIntHashMap;
|
|||
import org.elasticsearch.common.trove.TObjectIntIterator;
|
||||
import org.elasticsearch.index.cache.field.data.FieldDataCache;
|
||||
import org.elasticsearch.index.field.data.FieldData;
|
||||
import org.elasticsearch.index.field.data.FieldDataType;
|
||||
import org.elasticsearch.index.mapper.MapperService;
|
||||
import org.elasticsearch.script.search.SearchScript;
|
||||
import org.elasticsearch.search.facets.Facet;
|
||||
|
@ -66,7 +67,7 @@ public class TermsFacetCollector extends AbstractFacetCollector {
|
|||
|
||||
private final int numberOfShards;
|
||||
|
||||
private final FieldData.Type fieldDataType;
|
||||
private final FieldDataType fieldDataType;
|
||||
|
||||
private FieldData fieldData;
|
||||
|
||||
|
@ -87,7 +88,7 @@ public class TermsFacetCollector extends AbstractFacetCollector {
|
|||
MapperService.SmartNameFieldMappers smartMappers = context.mapperService().smartName(fieldName);
|
||||
if (smartMappers == null || !smartMappers.hasMapper()) {
|
||||
this.indexFieldName = fieldName;
|
||||
this.fieldDataType = FieldData.Type.STRING;
|
||||
this.fieldDataType = FieldDataType.DefaultTypes.STRING;
|
||||
} else {
|
||||
// add type filter if there is exact doc mapper associated with it
|
||||
if (smartMappers.hasDocMapper()) {
|
||||
|
|
|
@ -28,6 +28,7 @@ import org.elasticsearch.common.trove.TObjectIntHashMap;
|
|||
import org.elasticsearch.common.trove.TObjectIntIterator;
|
||||
import org.elasticsearch.index.cache.field.data.FieldDataCache;
|
||||
import org.elasticsearch.index.field.data.FieldData;
|
||||
import org.elasticsearch.index.field.data.FieldDataType;
|
||||
import org.elasticsearch.index.mapper.MapperService;
|
||||
import org.elasticsearch.script.search.SearchScript;
|
||||
import org.elasticsearch.search.facets.Facet;
|
||||
|
@ -58,7 +59,7 @@ public class TermsFieldsFacetCollector extends AbstractFacetCollector {
|
|||
|
||||
private final int numberOfShards;
|
||||
|
||||
private final FieldData.Type[] fieldsDataType;
|
||||
private final FieldDataType[] fieldsDataType;
|
||||
|
||||
private FieldData[] fieldsData;
|
||||
|
||||
|
@ -76,7 +77,7 @@ public class TermsFieldsFacetCollector extends AbstractFacetCollector {
|
|||
|
||||
this.fieldsNames = fieldsNames;
|
||||
|
||||
fieldsDataType = new FieldData.Type[fieldsNames.length];
|
||||
fieldsDataType = new FieldDataType[fieldsNames.length];
|
||||
fieldsData = new FieldData[fieldsNames.length];
|
||||
indexFieldsNames = new String[fieldsNames.length];
|
||||
|
||||
|
@ -84,7 +85,7 @@ public class TermsFieldsFacetCollector extends AbstractFacetCollector {
|
|||
MapperService.SmartNameFieldMappers smartMappers = context.mapperService().smartName(fieldsNames[i]);
|
||||
if (smartMappers == null || !smartMappers.hasMapper()) {
|
||||
this.indexFieldsNames[i] = fieldsNames[i];
|
||||
this.fieldsDataType[i] = FieldData.Type.STRING;
|
||||
this.fieldsDataType[i] = FieldDataType.DefaultTypes.STRING;
|
||||
} else {
|
||||
this.indexFieldsNames[i] = smartMappers.mapper().names().indexName();
|
||||
this.fieldsDataType[i] = smartMappers.mapper().fieldDataType();
|
||||
|
|
|
@ -25,7 +25,6 @@ import org.apache.lucene.index.IndexWriter;
|
|||
import org.apache.lucene.store.Directory;
|
||||
import org.apache.lucene.store.RAMDirectory;
|
||||
import org.elasticsearch.common.lucene.Lucene;
|
||||
import org.elasticsearch.index.field.data.FieldData;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -72,11 +71,9 @@ public class DoubleFieldDataTests {
|
|||
DoubleFieldData mFieldData = DoubleFieldData.load(reader, "mvalue");
|
||||
|
||||
assertThat(sFieldData.fieldName(), equalTo("svalue"));
|
||||
assertThat(sFieldData.type(), equalTo(FieldData.Type.DOUBLE));
|
||||
assertThat(sFieldData.multiValued(), equalTo(false));
|
||||
|
||||
assertThat(mFieldData.fieldName(), equalTo("mvalue"));
|
||||
assertThat(mFieldData.type(), equalTo(FieldData.Type.DOUBLE));
|
||||
assertThat(mFieldData.multiValued(), equalTo(true));
|
||||
|
||||
// svalue
|
||||
|
|
|
@ -25,7 +25,6 @@ import org.apache.lucene.index.IndexWriter;
|
|||
import org.apache.lucene.store.Directory;
|
||||
import org.apache.lucene.store.RAMDirectory;
|
||||
import org.elasticsearch.common.lucene.Lucene;
|
||||
import org.elasticsearch.index.field.data.FieldData;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -72,11 +71,9 @@ public class FloatFieldDataTests {
|
|||
FloatFieldData mFieldData = FloatFieldData.load(reader, "mvalue");
|
||||
|
||||
assertThat(sFieldData.fieldName(), equalTo("svalue"));
|
||||
assertThat(sFieldData.type(), equalTo(FieldData.Type.FLOAT));
|
||||
assertThat(sFieldData.multiValued(), equalTo(false));
|
||||
|
||||
assertThat(mFieldData.fieldName(), equalTo("mvalue"));
|
||||
assertThat(mFieldData.type(), equalTo(FieldData.Type.FLOAT));
|
||||
assertThat(mFieldData.multiValued(), equalTo(true));
|
||||
|
||||
// svalue
|
||||
|
|
|
@ -25,7 +25,6 @@ import org.apache.lucene.index.IndexWriter;
|
|||
import org.apache.lucene.store.Directory;
|
||||
import org.apache.lucene.store.RAMDirectory;
|
||||
import org.elasticsearch.common.lucene.Lucene;
|
||||
import org.elasticsearch.index.field.data.FieldData;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -72,11 +71,9 @@ public class IntFieldDataTests {
|
|||
IntFieldData mFieldData = IntFieldData.load(reader, "mvalue");
|
||||
|
||||
assertThat(sFieldData.fieldName(), equalTo("svalue"));
|
||||
assertThat(sFieldData.type(), equalTo(FieldData.Type.INT));
|
||||
assertThat(sFieldData.multiValued(), equalTo(false));
|
||||
|
||||
assertThat(mFieldData.fieldName(), equalTo("mvalue"));
|
||||
assertThat(mFieldData.type(), equalTo(FieldData.Type.INT));
|
||||
assertThat(mFieldData.multiValued(), equalTo(true));
|
||||
|
||||
// svalue
|
||||
|
|
|
@ -25,7 +25,6 @@ import org.apache.lucene.index.IndexWriter;
|
|||
import org.apache.lucene.store.Directory;
|
||||
import org.apache.lucene.store.RAMDirectory;
|
||||
import org.elasticsearch.common.lucene.Lucene;
|
||||
import org.elasticsearch.index.field.data.FieldData;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -72,11 +71,9 @@ public class LongFieldDataTests {
|
|||
LongFieldData mFieldData = LongFieldData.load(reader, "mvalue");
|
||||
|
||||
assertThat(sFieldData.fieldName(), equalTo("svalue"));
|
||||
assertThat(sFieldData.type(), equalTo(FieldData.Type.LONG));
|
||||
assertThat(sFieldData.multiValued(), equalTo(false));
|
||||
|
||||
assertThat(mFieldData.fieldName(), equalTo("mvalue"));
|
||||
assertThat(mFieldData.type(), equalTo(FieldData.Type.LONG));
|
||||
assertThat(mFieldData.multiValued(), equalTo(true));
|
||||
|
||||
// svalue
|
||||
|
|
|
@ -25,7 +25,6 @@ import org.apache.lucene.index.IndexWriter;
|
|||
import org.apache.lucene.store.Directory;
|
||||
import org.apache.lucene.store.RAMDirectory;
|
||||
import org.elasticsearch.common.lucene.Lucene;
|
||||
import org.elasticsearch.index.field.data.FieldData;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -72,11 +71,9 @@ public class ShortFieldDataTests {
|
|||
ShortFieldData mFieldData = ShortFieldData.load(reader, "mvalue");
|
||||
|
||||
assertThat(sFieldData.fieldName(), equalTo("svalue"));
|
||||
assertThat(sFieldData.type(), equalTo(FieldData.Type.SHORT));
|
||||
assertThat(sFieldData.multiValued(), equalTo(false));
|
||||
|
||||
assertThat(mFieldData.fieldName(), equalTo("mvalue"));
|
||||
assertThat(mFieldData.type(), equalTo(FieldData.Type.SHORT));
|
||||
assertThat(mFieldData.multiValued(), equalTo(true));
|
||||
|
||||
// svalue
|
||||
|
|
|
@ -65,11 +65,9 @@ public class StringFieldDataTests {
|
|||
StringFieldData mFieldData = StringFieldData.load(reader, "mvalue");
|
||||
|
||||
assertThat(sFieldData.fieldName(), equalTo("svalue"));
|
||||
assertThat(sFieldData.type(), equalTo(FieldData.Type.STRING));
|
||||
assertThat(sFieldData.multiValued(), equalTo(false));
|
||||
|
||||
assertThat(mFieldData.fieldName(), equalTo("mvalue"));
|
||||
assertThat(mFieldData.type(), equalTo(FieldData.Type.STRING));
|
||||
assertThat(mFieldData.multiValued(), equalTo(true));
|
||||
|
||||
// svalue
|
||||
|
|
Loading…
Reference in New Issue