mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-26 06:46:10 +00:00
lucene 4: Upgraded GeoDistanceRangeFilter, GeoPolygonFilter.
This commit is contained in:
parent
415cfa2e89
commit
d42d153c48
@ -20,9 +20,10 @@
|
|||||||
package org.elasticsearch.index.search.geo;
|
package org.elasticsearch.index.search.geo;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import org.apache.lucene.index.IndexReader;
|
import org.apache.lucene.index.AtomicReaderContext;
|
||||||
import org.apache.lucene.search.DocIdSet;
|
import org.apache.lucene.search.DocIdSet;
|
||||||
import org.apache.lucene.search.Filter;
|
import org.apache.lucene.search.Filter;
|
||||||
|
import org.apache.lucene.util.Bits;
|
||||||
import org.apache.lucene.util.NumericUtils;
|
import org.apache.lucene.util.NumericUtils;
|
||||||
import org.elasticsearch.ElasticSearchIllegalArgumentException;
|
import org.elasticsearch.ElasticSearchIllegalArgumentException;
|
||||||
import org.elasticsearch.common.lucene.docset.AndDocSet;
|
import org.elasticsearch.common.lucene.docset.AndDocSet;
|
||||||
@ -119,17 +120,17 @@ public class GeoDistanceRangeFilter extends Filter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DocIdSet getDocIdSet(IndexReader reader) throws IOException {
|
public DocIdSet getDocIdSet(AtomicReaderContext context, Bits acceptedDocs) throws IOException {
|
||||||
DocSet boundingBoxDocSet = null;
|
DocSet boundingBoxDocSet = null;
|
||||||
if (boundingBoxFilter != null) {
|
if (boundingBoxFilter != null) {
|
||||||
DocIdSet docIdSet = boundingBoxFilter.getDocIdSet(reader);
|
DocIdSet docIdSet = boundingBoxFilter.getDocIdSet(context, acceptedDocs);
|
||||||
if (docIdSet == null) {
|
if (docIdSet == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
boundingBoxDocSet = DocSets.convert(reader, docIdSet);
|
boundingBoxDocSet = DocSets.convert(context.reader(), docIdSet);
|
||||||
}
|
}
|
||||||
final GeoPointFieldData fieldData = (GeoPointFieldData) fieldDataCache.cache(GeoPointFieldDataType.TYPE, reader, fieldName);
|
final GeoPointFieldData fieldData = (GeoPointFieldData) fieldDataCache.cache(GeoPointFieldDataType.TYPE, context.reader(), fieldName);
|
||||||
GeoDistanceRangeDocSet distDocSet = new GeoDistanceRangeDocSet(reader.maxDoc(), fieldData, fixedSourceDistance, distanceBoundingCheck, inclusiveLowerPoint, inclusiveUpperPoint);
|
GeoDistanceRangeDocSet distDocSet = new GeoDistanceRangeDocSet(context.reader().maxDoc(), fieldData, fixedSourceDistance, distanceBoundingCheck, inclusiveLowerPoint, inclusiveUpperPoint);
|
||||||
if (boundingBoxDocSet == null) {
|
if (boundingBoxDocSet == null) {
|
||||||
return distDocSet;
|
return distDocSet;
|
||||||
} else {
|
} else {
|
||||||
|
@ -19,9 +19,10 @@
|
|||||||
|
|
||||||
package org.elasticsearch.index.search.geo;
|
package org.elasticsearch.index.search.geo;
|
||||||
|
|
||||||
import org.apache.lucene.index.IndexReader;
|
import org.apache.lucene.index.AtomicReaderContext;
|
||||||
import org.apache.lucene.search.DocIdSet;
|
import org.apache.lucene.search.DocIdSet;
|
||||||
import org.apache.lucene.search.Filter;
|
import org.apache.lucene.search.Filter;
|
||||||
|
import org.apache.lucene.util.Bits;
|
||||||
import org.elasticsearch.common.lucene.docset.GetDocSet;
|
import org.elasticsearch.common.lucene.docset.GetDocSet;
|
||||||
import org.elasticsearch.index.cache.field.data.FieldDataCache;
|
import org.elasticsearch.index.cache.field.data.FieldDataCache;
|
||||||
import org.elasticsearch.index.mapper.geo.GeoPointFieldData;
|
import org.elasticsearch.index.mapper.geo.GeoPointFieldData;
|
||||||
@ -56,9 +57,9 @@ public class GeoPolygonFilter extends Filter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DocIdSet getDocIdSet(IndexReader reader) throws IOException {
|
public DocIdSet getDocIdSet(AtomicReaderContext context, Bits acceptedDocs) throws IOException {
|
||||||
final GeoPointFieldData fieldData = (GeoPointFieldData) fieldDataCache.cache(GeoPointFieldDataType.TYPE, reader, fieldName);
|
final GeoPointFieldData fieldData = (GeoPointFieldData) fieldDataCache.cache(GeoPointFieldDataType.TYPE, context.reader(), fieldName);
|
||||||
return new GeoPolygonDocSet(reader.maxDoc(), fieldData, points);
|
return new GeoPolygonDocSet(context.reader().maxDoc(), fieldData, points);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user