mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-09 14:34:43 +00:00
Failure to reduce geo distance sorting (class case exception), closes #1234.
This commit is contained in:
parent
bf51a4e5df
commit
001a6b0ff7
@ -21,8 +21,9 @@ package org.elasticsearch.index.field.function.sort;
|
||||
|
||||
import org.apache.lucene.index.IndexReader;
|
||||
import org.apache.lucene.search.FieldComparator;
|
||||
import org.apache.lucene.search.FieldComparatorSource;
|
||||
import org.apache.lucene.search.Scorer;
|
||||
import org.apache.lucene.search.SortField;
|
||||
import org.elasticsearch.index.field.data.FieldDataType;
|
||||
import org.elasticsearch.script.SearchScript;
|
||||
|
||||
import java.io.IOException;
|
||||
@ -33,11 +34,11 @@ import java.io.IOException;
|
||||
// LUCENE MONITOR: Monitor against FieldComparator.Double
|
||||
public class DoubleFieldsFunctionDataComparator extends FieldComparator {
|
||||
|
||||
public static FieldComparatorSource comparatorSource(SearchScript script) {
|
||||
public static FieldDataType.ExtendedFieldComparatorSource comparatorSource(SearchScript script) {
|
||||
return new InnerSource(script);
|
||||
}
|
||||
|
||||
private static class InnerSource extends FieldComparatorSource {
|
||||
private static class InnerSource extends FieldDataType.ExtendedFieldComparatorSource {
|
||||
|
||||
private final SearchScript script;
|
||||
|
||||
@ -48,6 +49,10 @@ public class DoubleFieldsFunctionDataComparator extends FieldComparator {
|
||||
@Override public FieldComparator newComparator(String fieldname, int numHits, int sortPos, boolean reversed) throws IOException {
|
||||
return new DoubleFieldsFunctionDataComparator(numHits, script);
|
||||
}
|
||||
|
||||
@Override public int reducedType() {
|
||||
return SortField.DOUBLE;
|
||||
}
|
||||
}
|
||||
|
||||
private final SearchScript script;
|
||||
|
@ -21,8 +21,9 @@ package org.elasticsearch.index.field.function.sort;
|
||||
|
||||
import org.apache.lucene.index.IndexReader;
|
||||
import org.apache.lucene.search.FieldComparator;
|
||||
import org.apache.lucene.search.FieldComparatorSource;
|
||||
import org.apache.lucene.search.Scorer;
|
||||
import org.apache.lucene.search.SortField;
|
||||
import org.elasticsearch.index.field.data.FieldDataType;
|
||||
import org.elasticsearch.script.SearchScript;
|
||||
|
||||
import java.io.IOException;
|
||||
@ -32,11 +33,11 @@ import java.io.IOException;
|
||||
*/
|
||||
public class StringFieldsFunctionDataComparator extends FieldComparator {
|
||||
|
||||
public static FieldComparatorSource comparatorSource(SearchScript script) {
|
||||
public static FieldDataType.ExtendedFieldComparatorSource comparatorSource(SearchScript script) {
|
||||
return new InnerSource(script);
|
||||
}
|
||||
|
||||
private static class InnerSource extends FieldComparatorSource {
|
||||
private static class InnerSource extends FieldDataType.ExtendedFieldComparatorSource {
|
||||
|
||||
private final SearchScript script;
|
||||
|
||||
@ -47,6 +48,10 @@ public class StringFieldsFunctionDataComparator extends FieldComparator {
|
||||
@Override public FieldComparator newComparator(String fieldname, int numHits, int sortPos, boolean reversed) throws IOException {
|
||||
return new StringFieldsFunctionDataComparator(numHits, script);
|
||||
}
|
||||
|
||||
@Override public int reducedType() {
|
||||
return SortField.STRING;
|
||||
}
|
||||
}
|
||||
|
||||
private final SearchScript script;
|
||||
|
@ -21,10 +21,11 @@ package org.elasticsearch.index.search.geo;
|
||||
|
||||
import org.apache.lucene.index.IndexReader;
|
||||
import org.apache.lucene.search.FieldComparator;
|
||||
import org.apache.lucene.search.FieldComparatorSource;
|
||||
import org.apache.lucene.search.SortField;
|
||||
import org.elasticsearch.ElasticSearchIllegalArgumentException;
|
||||
import org.elasticsearch.common.unit.DistanceUnit;
|
||||
import org.elasticsearch.index.cache.field.data.FieldDataCache;
|
||||
import org.elasticsearch.index.field.data.FieldDataType;
|
||||
import org.elasticsearch.index.mapper.FieldMapper;
|
||||
import org.elasticsearch.index.mapper.MapperService;
|
||||
import org.elasticsearch.index.mapper.geo.GeoPointFieldData;
|
||||
@ -38,12 +39,12 @@ import java.io.IOException;
|
||||
// LUCENE MONITOR: Monitor against FieldComparator.Double
|
||||
public class GeoDistanceDataComparator extends FieldComparator {
|
||||
|
||||
public static FieldComparatorSource comparatorSource(String fieldName, double lat, double lon, DistanceUnit unit, GeoDistance geoDistance,
|
||||
FieldDataCache fieldDataCache, MapperService mapperService) {
|
||||
public static FieldDataType.ExtendedFieldComparatorSource comparatorSource(String fieldName, double lat, double lon, DistanceUnit unit, GeoDistance geoDistance,
|
||||
FieldDataCache fieldDataCache, MapperService mapperService) {
|
||||
return new InnerSource(fieldName, lat, lon, unit, geoDistance, fieldDataCache, mapperService);
|
||||
}
|
||||
|
||||
private static class InnerSource extends FieldComparatorSource {
|
||||
static class InnerSource extends FieldDataType.ExtendedFieldComparatorSource {
|
||||
|
||||
protected final String fieldName;
|
||||
|
||||
@ -73,6 +74,10 @@ public class GeoDistanceDataComparator extends FieldComparator {
|
||||
@Override public FieldComparator newComparator(String fieldname, int numHits, int sortPos, boolean reversed) throws IOException {
|
||||
return new GeoDistanceDataComparator(numHits, fieldname, lat, lon, unit, geoDistance, fieldDataCache, mapperService);
|
||||
}
|
||||
|
||||
@Override public int reducedType() {
|
||||
return SortField.DOUBLE;
|
||||
}
|
||||
}
|
||||
|
||||
protected final String fieldName;
|
||||
|
Loading…
x
Reference in New Issue
Block a user