/** * Compose a query from the set of constraints. When the provided constraints do not fulfill the * indexed dimensions, compose constraints from statistics. * * @param featureType * @param timeDescriptors * @param statsMap * @param jtsBounds * @param timeBoundsSet * @return */ public static Constraints composeConstraints( final SimpleFeatureType featureType, final TimeDescriptors timeDescriptors, final Map<StatisticsId, InternalDataStatistics<SimpleFeature, ?, ?>> statsMap, final Geometry jtsBounds, final TemporalConstraintsSet timeBoundsSet) { final Constraints timeConstraints = composeTimeConstraints(featureType, timeDescriptors, statsMap, timeBoundsSet); final GeoConstraintsWrapper geoConstraints = composeGeometricConstraints(featureType, statsMap, jtsBounds); return timeConstraints.merge(geoConstraints.getConstraints()); } }
private BasicQuery getQuery( final Map<StatisticsId, InternalDataStatistics<SimpleFeature, ?, ?>> statsMap, final Geometry jtsBounds, final TemporalConstraintsSet timeBounds) { final Constraints timeConstraints = QueryIndexHelper.composeTimeBoundedConstraints( components.getAdapter().getFeatureType(), components.getAdapter().getTimeDescriptors(), statsMap, timeBounds); final GeoConstraintsWrapper geoConstraints = QueryIndexHelper.composeGeometricConstraints(getFeatureType(), statsMap, jtsBounds); /** * NOTE: query to an index that requires a constraint and the constraint is missing equates to a * full table scan. @see BasicQuery */ final BasicQuery query = composeQuery(geoConstraints, timeConstraints); query.setExact(timeBounds.isExact()); return query; }