本文整理了Java中org.springframework.data.mongodb.core.query.Criteria.within()
方法的一些代码示例,展示了Criteria.within()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Criteria.within()
方法的具体详情如下:
包路径:org.springframework.data.mongodb.core.query.Criteria
类名称:Criteria
方法名:within
[英]Creates a geospatial criterion using a $geoWithin operation.
[中]使用$GEOIN操作创建地理空间标准。
代码示例来源:origin: spring-projects/spring-data-mongodb
return criteria.within((Shape) parameter);
case SIMPLE_PROPERTY:
代码示例来源:origin: org.springframework.data/spring-data-mongodb
return criteria.within((Shape) parameter);
case SIMPLE_PROPERTY:
代码示例来源:origin: sentilo/sentilo
public SearchFilterResult<Component> geoSpatialSearch(final SearchFilter filter) {
if (SentiloUtils.arrayIsEmpty(filter.getBounds())) {
return super.search(filter);
}
// bounds = [lat_lo_left,lng_lo_left,lat_hi_west,lng_hi_west]
final String[] mapBounds = filter.getBounds();
final double[] lowerLeft = {Double.parseDouble(mapBounds[1]), Double.parseDouble(mapBounds[0])};
final double[] upperRight = {Double.parseDouble(mapBounds[3]), Double.parseDouble(mapBounds[2])};
final Box mapBox = new Box(lowerLeft, upperRight);
final Criteria geoSpatialCriteria = Criteria.where("location.centroid").within(mapBox);
final Query query = buildQuery(filter, false, geoSpatialCriteria);
LOGGER.debug("GeoSpatial Search - query: {}", query);
final List<Component> content = getMongoOps().find(query, Component.class);
return new SearchFilterResult<Component>(content, filter, content.size());
}
内容来源于网络,如有侵权,请联系作者删除!