Skip to content

Commit

Permalink
fix for 1105: postgis query too large
Browse files Browse the repository at this point in the history
There are two strategies in this fix:

1.  The method that makes the getFeature requests in the spatial filter now limits the number of features to 5000 and will make multiple requests
2.  A performance enhancement.  It will limit the number of features in get features to numHits.  So if we are loading hits 10-15 at most 15 features will be loaded.
  • Loading branch information
Jesse Eichar committed Oct 10, 2012
1 parent 99daf8d commit 76fcaf6
Show file tree
Hide file tree
Showing 20 changed files with 72 additions and 51 deletions.
2 changes: 1 addition & 1 deletion docs
Submodule docs updated 667 files
2 changes: 1 addition & 1 deletion gast
Submodule gast updated 65 files
+4 −0 .gitignore
+14 −6 pom.xml
+ setup/sample-data/dublin-core.mef
+ setup/sample-data/fgdc.mef
+ setup/sample-data/iso-19115.mef
+ setup/sample-data/iso-19139-basins-in-africa.mef
+ setup/sample-data/iso-19139-physiographic.mef
+ setup/sample-data/locality_polygons_comprehensive.mef
+ setup/sample-data/photographic_session.mef
+0 −1 setup/sql/.ignore
+2 −2 src/main/configurations/org/fao/gast/boot/std-config.properties
+12 −27 src/main/java/org/fao/gast/boot/Config.java
+6 −14 src/main/java/org/fao/gast/cli/Cli.java
+0 −44 src/main/java/org/fao/gast/cli/createdb/CreateDB.java
+0 −87 src/main/java/org/fao/gast/cli/sampledata/SampleData.java
+0 −63 src/main/java/org/fao/gast/cli/setup/Setup.java
+17 −1 src/main/java/org/fao/gast/gui/GuiBuilder.java
+0 −63 src/main/java/org/fao/gast/gui/MainFrame.java
+5 −1 src/main/java/org/fao/gast/gui/ViewPanel.java
+4 −4 src/main/java/org/fao/gast/gui/dialogs/StartupConfigPanel.java
+205 −0 src/main/java/org/fao/gast/gui/panels/config/dbms/DB2Panel.java
+39 −8 src/main/java/org/fao/gast/gui/panels/config/dbms/GenericPanel.java
+78 −62 src/main/java/org/fao/gast/gui/panels/config/dbms/H2Panel.java
+162 −0 src/main/java/org/fao/gast/gui/panels/config/dbms/JNDIPanel.java
+23 −7 src/main/java/org/fao/gast/gui/panels/config/dbms/MainPanel.java
+25 −7 src/main/java/org/fao/gast/gui/panels/config/dbms/MckoiPanel.java
+21 −7 src/main/java/org/fao/gast/gui/panels/config/dbms/MySQLPanel.java
+13 −3 src/main/java/org/fao/gast/gui/panels/config/dbms/OraclePanel.java
+21 −9 src/main/java/org/fao/gast/gui/panels/config/dbms/PostgisPanel.java
+19 −5 src/main/java/org/fao/gast/gui/panels/config/dbms/PostgresPanel.java
+162 −0 src/main/java/org/fao/gast/gui/panels/config/dbms/SQLServerPanel.java
+0 −114 src/main/java/org/fao/gast/gui/panels/config/siteid/MainPanel.java
+0 −124 src/main/java/org/fao/gast/gui/panels/database/sample/MainPanel.java
+0 −166 src/main/java/org/fao/gast/gui/panels/database/sample/Worker.java
+0 −78 src/main/java/org/fao/gast/gui/panels/database/setup/MainPanel.java
+0 −128 src/main/java/org/fao/gast/gui/panels/database/setup/Worker.java
+0 −93 src/main/java/org/fao/gast/gui/panels/manag/conversion/MainPanel.java
+0 −186 src/main/java/org/fao/gast/gui/panels/manag/conversion/Worker.java
+0 −104 src/main/java/org/fao/gast/gui/panels/manag/mdsync/MainPanel.java
+0 −160 src/main/java/org/fao/gast/gui/panels/manag/mefexport/MainPanel.java
+0 −233 src/main/java/org/fao/gast/gui/panels/manag/mefexport/SearchPanel.java
+0 −270 src/main/java/org/fao/gast/gui/panels/manag/mefexport/Worker.java
+0 −169 src/main/java/org/fao/gast/gui/panels/manag/mefimport/Worker.java
+0 −68 src/main/java/org/fao/gast/gui/panels/migration/oldinst/GNSource.java
+0 −190 src/main/java/org/fao/gast/gui/panels/migration/oldinst/MainPanel.java
+0 −137 src/main/java/org/fao/gast/gui/panels/migration/oldinst/OldConfigLib.java
+0 −190 src/main/java/org/fao/gast/gui/panels/migration/oldinst/UserDialog.java
+0 −1,149 src/main/java/org/fao/gast/gui/panels/migration/oldinst/Worker.java
+119 −31 src/main/java/org/fao/gast/lib/ConfigLib.java
+0 −629 src/main/java/org/fao/gast/lib/DatabaseLib.java
+3 −13 src/main/java/org/fao/gast/lib/EmbeddedSCLib.java
+0 −7 src/main/java/org/fao/gast/lib/Lib.java
+0 −345 src/main/java/org/fao/gast/lib/MefLib.java
+0 −409 src/main/java/org/fao/gast/lib/MetadataLib.java
+0 −153 src/main/java/org/fao/gast/lib/Resource.java
+0 −87 src/main/java/org/fao/gast/lib/ServiceLib.java
+0 −95 src/main/java/org/fao/gast/lib/SiteLib.java
+2 −1 src/main/java/org/fao/gast/lib/XMLLib.java
+8 −86 src/main/resources/data/gui.properties
+10 −236 src/main/resources/data/gui.xml
+25 −2 src/main/resources/org/fao/gast/localization/messages.properties
+0 −114 src/main/resources/org/fao/gast/localization/messages_el.properties
+30 −1 src/main/resources/org/fao/gast/localization/messages_fr.properties
+0 −117 src/main/resources/org/fao/gast/localization/messages_tr.properties
+0 −1 src/test/java/.ignore
2 changes: 1 addition & 1 deletion geoserver
Submodule geoserver updated 279 files
2 changes: 1 addition & 1 deletion maven_repo
Submodule maven_repo updated 48 files
+ com/cybozu/labs/langdetect/1.0.0.0/langdetect-1.0.0.0.jar
+1 −0 com/cybozu/labs/langdetect/1.0.0.0/langdetect-1.0.0.0.jar.sha1
+6 −0 com/cybozu/labs/langdetect/1.0.0.0/langdetect-1.0.0.0.pom
+1 −0 com/cybozu/labs/langdetect/1.0.0.0/langdetect-1.0.0.0.pom.md5
+1 −0 com/cybozu/labs/langdetect/1.0.0.0/langdetect-1.0.0.0.pom.sha1
+1 −0 com/cybozu/labs/langdetect/1.0.0.0/langdetect.-1.0.0.0.jar.md5
+11 −0 com/cybozu/labs/langdetect/maven-metadata.xml
+1 −0 com/cybozu/labs/langdetect/maven-metadata.xml.md5
+1 −0 com/cybozu/labs/langdetect/maven-metadata.xml.sha1
+ net/sf/saxon/saxon-dom/9.1.0.8b/saxon-dom-9.1.0.8b.jar
+1 −0 net/sf/saxon/saxon-dom/9.1.0.8b/saxon-dom-9.1.0.8b.jar.md5
+1 −0 net/sf/saxon/saxon-dom/9.1.0.8b/saxon-dom-9.1.0.8b.jar.sha1
+6 −0 net/sf/saxon/saxon-dom/9.1.0.8b/saxon-dom-9.1.0.8b.pom
+1 −0 net/sf/saxon/saxon-dom/9.1.0.8b/saxon-dom-9.1.0.8b.pom.md5
+1 −0 net/sf/saxon/saxon-dom/9.1.0.8b/saxon-dom-9.1.0.8b.pom.sha1
+11 −0 net/sf/saxon/saxon-dom/maven-metadata.xml
+1 −0 net/sf/saxon/saxon-dom/maven-metadata.xml.md5
+1 −0 net/sf/saxon/saxon-dom/maven-metadata.xml.sha1
+1 −1 net/sf/saxon/saxon/9.1.0.8b-patch/saxon-9.1.0.8b-patch.pom
+0 −1 net/sf/saxon/saxon/9.1.0.8b-patch/saxon-9.1.0.8b-patch.pom.md5
+0 −1 net/sf/saxon/saxon/9.1.0.8b-patch/saxon-9.1.0.8b-patch.pom.sha1
+9 −0 org/geoserver/charts-plugin/2.1.1/charts-plugin-2.1.1.pom
+1 −0 org/geoserver/charts-plugin/2.1.1/charts-plugin-2.1.1.pom.md5
+1 −0 org/geoserver/charts-plugin/2.1.1/charts-plugin-2.1.1.pom.sha1
+ org/geoserver/charts-plugin/2.1.1/charts-plugin-2.1.1.zip
+1 −0 org/geoserver/charts-plugin/2.1.1/charts-plugin-2.1.1.zip.md5
+1 −0 org/geoserver/charts-plugin/2.1.1/charts-plugin-2.1.1.zip.sha1
+12 −0 org/geoserver/charts-plugin/maven-metadata.xml
+1 −0 org/geoserver/charts-plugin/maven-metadata.xml.md5
+1 −0 org/geoserver/charts-plugin/maven-metadata.xml.sha1
+9 −0 org/geoserver/geoserver/2.1.1/geoserver-2.1.1.pom
+1 −0 org/geoserver/geoserver/2.1.1/geoserver-2.1.1.pom.md5
+1 −0 org/geoserver/geoserver/2.1.1/geoserver-2.1.1.pom.sha1
+ org/geoserver/geoserver/2.1.1/geoserver-2.1.1.war
+1 −0 org/geoserver/geoserver/2.1.1/geoserver-2.1.1.war.md5
+1 −0 org/geoserver/geoserver/2.1.1/geoserver-2.1.1.war.sha1
+13 −0 org/geoserver/geoserver/maven-metadata.xml
+1 −0 org/geoserver/geoserver/maven-metadata.xml.md5
+1 −0 org/geoserver/geoserver/maven-metadata.xml.sha1
+9 −0 org/geoserver/styler/2.1.1/styler-2.1.1.pom
+1 −0 org/geoserver/styler/2.1.1/styler-2.1.1.pom.md5
+1 −0 org/geoserver/styler/2.1.1/styler-2.1.1.pom.sha1
+ org/geoserver/styler/2.1.1/styler-2.1.1.zip
+1 −0 org/geoserver/styler/2.1.1/styler-2.1.1.zip.md5
+1 −0 org/geoserver/styler/2.1.1/styler-2.1.1.zip.sha1
+12 −0 org/geoserver/styler/maven-metadata.xml
+1 −0 org/geoserver/styler/maven-metadata.xml.md5
+1 −0 org/geoserver/styler/maven-metadata.xml.sha1
2 changes: 1 addition & 1 deletion release
Submodule release updated 170 files
Expand Up @@ -368,13 +368,14 @@ private Pair<Element, List<ResultItem>> performSearch(
// --- proper search
Log.debug(Geonet.CSW_SEARCH, "Lucene query: " + query.toString());

int numHits = startPosition + maxRecords;

// TODO Handle NPE creating spatial filter (due to constraint
// language version).
Filter spatialfilter = sm.getSpatial().filter(query, filterExpr, filterVersion);
Filter spatialfilter = sm.getSpatial().filter(query, numHits, filterExpr, filterVersion);
CachingWrapperFilter cFilter = null;
if (spatialfilter != null) cFilter = new CachingWrapperFilter(spatialfilter);
boolean buildSummary = resultType == ResultType.RESULTS_WITH_SUMMARY;
int numHits = startPosition + maxRecords;

// get as many results as instructed or enough for search summary
if (buildSummary) {
Expand Down
Expand Up @@ -185,8 +185,8 @@ public final FieldSelectorResult accept(String name) {
public void search(ServiceContext srvContext, Element request, ServiceConfig config) throws Exception {
IndexSearcher searcher = getNewSearcher();
try {
computeQuery(srvContext, request, config, searcher);
initSearchRange(srvContext);
computeQuery(srvContext, request, config, searcher);
performQuery(getFrom()-1, getTo(), searcher);
} finally {
releaseSearcher();
Expand Down Expand Up @@ -435,7 +435,7 @@ else if (userSession.getProfile().equals(Geonet.Profile.REVIEWER)) {

Geometry geometry = getGeometry(request);
if (geometry != null) {
_filter = new CachingWrapperFilter(_sm.getSpatial().filter(_query, geometry, request));
_filter = new CachingWrapperFilter(_sm.getSpatial().filter(_query, getTo() - 1, geometry, request));
}

String sortBy = Util.getParam(request, Geonet.SearchResult.SORT_BY,
Expand Down
17 changes: 7 additions & 10 deletions web/src/main/java/org/fao/geonet/kernel/search/SearchManager.java
Expand Up @@ -1218,15 +1218,13 @@ public void run()
* @return
* @throws Exception
*/
public Filter filter(org.apache.lucene.search.Query query, Element filterExpr, String filterVersion)
throws Exception
{

public Filter filter(org.apache.lucene.search.Query query, int numHits, Element filterExpr, String filterVersion)
throws Exception {
_lock.lock();
try {
Parser filterParser = getFilterParser(filterVersion);
Pair<FeatureSource<SimpleFeatureType, SimpleFeature>, SpatialIndex> accessor = new SpatialIndexAccessor();
return OgcGenericFilters.create(query, filterExpr, accessor , filterParser);
return OgcGenericFilters.create(query, numHits, filterExpr, accessor , filterParser);
}
catch (Exception e) {
// TODO Handle NPE creating spatial filter (due to constraint language version).
Expand All @@ -1247,15 +1245,14 @@ public Filter filter(org.apache.lucene.search.Query query, Element filterExpr, S
* @return
* @throws Exception
*/
public SpatialFilter filter(org.apache.lucene.search.Query query,
Geometry geom, Element request) throws Exception
{
public SpatialFilter filter(org.apache.lucene.search.Query query, int numHits,
Geometry geom, Element request) throws Exception {
_lock.lock();
try {
String relation = Util.getParam(request,
Geonet.SearchResult.RELATION,
Geonet.SearchResult.Relation.INTERSECTION);
return _types.get(relation).newInstance(query, geom, new SpatialIndexAccessor());
return _types.get(relation).newInstance(query, numHits, geom, new SpatialIndexAccessor());
}
finally {
_lock.unlock();
Expand Down Expand Up @@ -1365,7 +1362,7 @@ public void run()
*/
private static Constructor<? extends SpatialFilter> constructor(Class<? extends SpatialFilter> clazz)
throws SecurityException, NoSuchMethodException {
return clazz.getConstructor(org.apache.lucene.search.Query.class, Geometry.class, Pair.class);
return clazz.getConstructor(org.apache.lucene.search.Query.class, int.class, Geometry.class, Pair.class);
}

}
Expand Up @@ -48,9 +48,9 @@ public class ContainsFilter extends SpatialFilter

private static final long serialVersionUID = 1114543251684147194L;

public ContainsFilter(Query query, Geometry geom, Pair<FeatureSource<SimpleFeatureType, SimpleFeature>, SpatialIndex> sourceAccessor) throws IOException
public ContainsFilter(Query query, int numHits, Geometry geom, Pair<FeatureSource<SimpleFeatureType, SimpleFeature>, SpatialIndex> sourceAccessor) throws IOException
{
super(query, geom, sourceAccessor);
super(query, numHits, geom, sourceAccessor);
}

protected SpatialOperator createGeomFilter(FilterFactory2 filterFactory,
Expand Down
Expand Up @@ -48,9 +48,9 @@ public class CrossesFilter extends SpatialFilter

private static final long serialVersionUID = 1114543251684147194L;

public CrossesFilter(Query query, Geometry geom, Pair<FeatureSource<SimpleFeatureType, SimpleFeature>, SpatialIndex> sourceAccessor) throws IOException
public CrossesFilter(Query query, int numHits, Geometry geom, Pair<FeatureSource<SimpleFeatureType, SimpleFeature>, SpatialIndex> sourceAccessor) throws IOException
{
super(query, geom, sourceAccessor);
super(query, numHits, geom, sourceAccessor);
}

protected SpatialOperator createGeomFilter(FilterFactory2 filterFactory,
Expand Down
Expand Up @@ -48,9 +48,9 @@ public class EqualsFilter extends SpatialFilter

private static final long serialVersionUID = 1114543251684147194L;

public EqualsFilter(Query query, Geometry geom, Pair<FeatureSource<SimpleFeatureType, SimpleFeature>, SpatialIndex> sourceAccessor) throws IOException
public EqualsFilter(Query query, int numHits, Geometry geom, Pair<FeatureSource<SimpleFeatureType, SimpleFeature>, SpatialIndex> sourceAccessor) throws IOException
{
super(query, geom, sourceAccessor);
super(query, numHits, geom, sourceAccessor);
}

protected SpatialOperator createGeomFilter(FilterFactory2 filterFactory,
Expand Down
Expand Up @@ -63,16 +63,16 @@ public class FullScanFilter extends SpatialFilter
private static final long serialVersionUID = 1114543251684147194L;
private Set<String> _matches;

public FullScanFilter(Query query, Geometry geom,
public FullScanFilter(Query query, int numHits, Geometry geom,
Pair<FeatureSource<SimpleFeatureType, SimpleFeature>, SpatialIndex> sourceAccessor) throws IOException
{
super(query, geom, sourceAccessor);
super(query, numHits, geom, sourceAccessor);
}

protected FullScanFilter(Query query, Envelope bounds,
protected FullScanFilter(Query query, int numHits, Envelope bounds,
Pair<FeatureSource<SimpleFeatureType, SimpleFeature>, SpatialIndex> sourceAccessor) throws IOException
{
super(query, bounds, sourceAccessor);
super(query, numHits, bounds, sourceAccessor);
}

public BitSet bits(final IndexReader reader) throws IOException
Expand Down
Expand Up @@ -48,9 +48,9 @@ public class IntersectionFilter extends SpatialFilter

private static final long serialVersionUID = 1114543251684147194L;

public IntersectionFilter(Query query, Geometry geom, Pair<FeatureSource<SimpleFeatureType, SimpleFeature>, SpatialIndex> sourceAccessor) throws IOException
public IntersectionFilter(Query query, int numHits, Geometry geom, Pair<FeatureSource<SimpleFeatureType, SimpleFeature>, SpatialIndex> sourceAccessor) throws IOException
{
super(query, geom, sourceAccessor);
super(query, numHits, geom, sourceAccessor);
}

protected SpatialOperator createGeomFilter(FilterFactory2 filterFactory,
Expand Down
Expand Up @@ -42,9 +42,9 @@ public class IsFullyOutsideOfFilter extends SpatialFilter

private static final long serialVersionUID = 1114543251684147194L;

public IsFullyOutsideOfFilter(Query query, Geometry geom, Pair<FeatureSource<SimpleFeatureType, SimpleFeature>, SpatialIndex> sourceAccessor) throws IOException
public IsFullyOutsideOfFilter(Query query, int numHits, Geometry geom, Pair<FeatureSource<SimpleFeatureType, SimpleFeature>, SpatialIndex> sourceAccessor) throws IOException
{
super(query, geom, sourceAccessor);
super(query, numHits, geom, sourceAccessor);
}

protected SpatialOperator createGeomFilter(FilterFactory2 filterFactory,
Expand Down
Expand Up @@ -87,7 +87,7 @@ public class OgcGenericFilters
* @throws Exception
*/
@SuppressWarnings("serial")
public static SpatialFilter create(Query query,
public static SpatialFilter create(Query query, int numHits,
Element filterExpr, Pair<FeatureSource<SimpleFeatureType, SimpleFeature>, SpatialIndex> sourceAccessor, Parser parser) throws Exception
{
// -- parse Filter and report any validation issues
Expand Down Expand Up @@ -136,15 +136,15 @@ public static SpatialFilter create(Query query,

Boolean disjointFilter = (Boolean) finalFilter.accept(new DisjointDetector(), false);
if( disjointFilter ){
return new FullScanFilter(query, bounds, sourceAccessor){
return new FullScanFilter(query, numHits, bounds, sourceAccessor){
@Override
protected Filter createFilter(FeatureSource source)
{
return finalFilter;
}
};
}else{
return new SpatialFilter(query, bounds, sourceAccessor){
return new SpatialFilter(query, numHits, bounds, sourceAccessor){
@Override
protected Filter createFilter(FeatureSource source)
{
Expand Down
Expand Up @@ -48,9 +48,9 @@ public class OverlapsFilter extends SpatialFilter

private static final long serialVersionUID = 1114543251684147194L;

public OverlapsFilter(Query query, Geometry geom, Pair<FeatureSource<SimpleFeatureType, SimpleFeature>, SpatialIndex> sourceAccessor) throws IOException
public OverlapsFilter(Query query, int numHits, Geometry geom, Pair<FeatureSource<SimpleFeatureType, SimpleFeature>, SpatialIndex> sourceAccessor) throws IOException
{
super(query, geom, sourceAccessor);
super(query, numHits, geom, sourceAccessor);
}

protected SpatialOperator createGeomFilter(FilterFactory2 filterFactory,
Expand Down
Expand Up @@ -61,8 +61,10 @@

import java.io.IOException;
import java.util.BitSet;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
Expand All @@ -79,6 +81,7 @@ public abstract class SpatialFilter extends Filter
}

private static final Geometry WORLD_BOUNDS;
private static final int MAX_FIDS_PER_QUERY = 5000;
static {
GeometryFactory fac = new GeometryFactory();
WORLD_BOUNDS = fac.toGeometry(new Envelope(-180,180,-90,90));
Expand All @@ -92,12 +95,14 @@ public abstract class SpatialFilter extends Filter
protected final FieldSelector _selector;
private Map<String, FeatureId> _unrefinedMatches;
private boolean warned = false;
private int _numHits;
private int _hits = 0;


protected SpatialFilter(Query query, Geometry geom, Pair<FeatureSource<SimpleFeatureType, SimpleFeature>, SpatialIndex> sourceAccessor) throws IOException
protected SpatialFilter(Query query, int numHits, Geometry geom, Pair<FeatureSource<SimpleFeatureType, SimpleFeature>, SpatialIndex> sourceAccessor) throws IOException
{
_query = query;
_geom = geom;
_numHits = numHits;
this.sourceAccessor = sourceAccessor;
_filterFactory = CommonFactoryFinder.getFilterFactory2(GeoTools
.getDefaultHints());
Expand All @@ -110,9 +115,9 @@ public final FieldSelectorResult accept(String name) {
};
}

protected SpatialFilter(Query query, Envelope bounds, Pair<FeatureSource<SimpleFeatureType, SimpleFeature>, SpatialIndex> sourceAccessor) throws IOException
protected SpatialFilter(Query query, int numHits, Envelope bounds, Pair<FeatureSource<SimpleFeatureType, SimpleFeature>, SpatialIndex> sourceAccessor) throws IOException
{
this(query,JTS.toGeometry(bounds),sourceAccessor);
this(query,numHits,JTS.toGeometry(bounds),sourceAccessor);
}

public DocIdSet getDocIdSet(final IndexReader reader) throws IOException
Expand All @@ -123,8 +128,9 @@ public DocIdSet getDocIdSet(final IndexReader reader) throws IOException
final Set<FeatureId> matches = new HashSet<FeatureId>();
final Map<FeatureId,Integer> docIndexLookup = new HashMap<FeatureId,Integer>();

new IndexSearcher(reader).search(_query, new Collector()
{
if(unrefinedSpatialMatches.isEmpty() || _hits >= _numHits) return new DocIdBitSet(bits);

new IndexSearcher(reader).search(_query, new Collector() {
private int docBase;

//ignore scorer
Expand All @@ -142,7 +148,8 @@ public final void collect(int doc)
Document document = reader.document(doc, _selector);
String key = document.get("_id");
FeatureId featureId = unrefinedSpatialMatches.get(key);
if (featureId!=null) {
if (featureId!=null && _hits < _numHits) {
_hits ++ ;
matches.add(featureId);
docIndexLookup.put(featureId, doc);
}
Expand All @@ -165,7 +172,22 @@ public void setNextReader(IndexReader reader, int docBase) {

private BitSet applySpatialFilter(Set<FeatureId> matches, Map<FeatureId, Integer> docIndexLookup, BitSet bits) throws IOException
{
Id fidFilter = _filterFactory.id(matches);

while (!matches.isEmpty()) {
Id fidFilter;
if(matches.size() > MAX_FIDS_PER_QUERY) {
Set<FeatureId> subset = new HashSet<FeatureId>((int)(MAX_FIDS_PER_QUERY*1.30));
int i = 0;
Iterator<FeatureId> iter = matches.iterator();
while(iter.hasNext() && i < MAX_FIDS_PER_QUERY) {
subset.add(iter.next());
iter.remove();
}
fidFilter = _filterFactory.id(subset);
} else {
fidFilter = _filterFactory.id(matches);
matches = Collections.emptySet();
}
FeatureSource<SimpleFeatureType, SimpleFeature> _featureSource = sourceAccessor.one();
String ftn = _featureSource.getSchema().getName().getLocalPart();
String[] geomAtt = {_featureSource.getSchema().getGeometryDescriptor().getLocalName()};
Expand All @@ -185,6 +207,7 @@ private BitSet applySpatialFilter(Set<FeatureId> matches, Map<FeatureId, Integer
} finally {
iterator.close();
}
}
return bits;
}

Expand Down
Expand Up @@ -48,9 +48,9 @@ public class TouchesFilter extends SpatialFilter

private static final long serialVersionUID = 1114543251684147194L;

public TouchesFilter(Query query, Geometry geom, Pair<FeatureSource<SimpleFeatureType, SimpleFeature>, SpatialIndex> sourceAccessor) throws IOException
public TouchesFilter(Query query, int numHits, Geometry geom, Pair<FeatureSource<SimpleFeatureType, SimpleFeature>, SpatialIndex> sourceAccessor) throws IOException
{
super(query, geom, sourceAccessor);
super(query, numHits, geom, sourceAccessor);
}

protected SpatialOperator createGeomFilter(FilterFactory2 filterFactory,
Expand Down
Expand Up @@ -48,9 +48,9 @@ public class WithinFilter extends SpatialFilter

private static final long serialVersionUID = 1114543251684147194L;

public WithinFilter(Query query, Geometry geom, Pair<FeatureSource<SimpleFeatureType, SimpleFeature>, SpatialIndex> sourceAccessor) throws IOException
public WithinFilter(Query query, int numHits, Geometry geom, Pair<FeatureSource<SimpleFeatureType, SimpleFeature>, SpatialIndex> sourceAccessor) throws IOException
{
super(query, geom, sourceAccessor);
super(query, numHits, geom, sourceAccessor);
}

protected SpatialOperator createGeomFilter(FilterFactory2 filterFactory,
Expand Down

0 comments on commit 76fcaf6

Please sign in to comment.