本文整理汇总了Java中org.elasticsearch.common.geo.ShapeRelation.WITHIN属性的典型用法代码示例。如果您正苦于以下问题:Java ShapeRelation.WITHIN属性的具体用法?Java ShapeRelation.WITHIN怎么用?Java ShapeRelation.WITHIN使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.elasticsearch.common.geo.ShapeRelation
的用法示例。
在下文中一共展示了ShapeRelation.WITHIN属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: rangeQuery
public Query rangeQuery(String field, Object from, Object to, boolean includeFrom, boolean includeTo,
ShapeRelation relation, @Nullable DateTimeZone timeZone, @Nullable DateMathParser dateMathParser,
QueryShardContext context) {
Number lower = from == null ? minValue() : numberType.parse(from, false);
Number upper = to == null ? maxValue() : numberType.parse(to, false);
if (relation == ShapeRelation.WITHIN) {
return withinQuery(field, lower, upper, includeFrom, includeTo);
} else if (relation == ShapeRelation.CONTAINS) {
return containsQuery(field, lower, upper, includeFrom, includeTo);
}
return intersectsQuery(field, lower, upper, includeFrom, includeTo);
}
示例2: getIntRangeQuery
private Query getIntRangeQuery(ShapeRelation relation, int from, int to, boolean includeLower, boolean includeUpper) {
int[] lower = new int[] {from + (includeLower ? 0 : 1)};
int[] upper = new int[] {to - (includeUpper ? 0 : 1)};
if (relation == ShapeRelation.WITHIN) {
return IntRangeField.newWithinQuery(FIELDNAME, lower, upper);
} else if (relation == ShapeRelation.CONTAINS) {
return IntRangeField.newContainsQuery(FIELDNAME, lower, upper);
}
return IntRangeField.newIntersectsQuery(FIELDNAME, lower, upper);
}
示例3: getLongRangeQuery
private Query getLongRangeQuery(ShapeRelation relation, long from, long to, boolean includeLower, boolean includeUpper) {
long[] lower = new long[] {from + (includeLower ? 0 : 1)};
long[] upper = new long[] {to - (includeUpper ? 0 : 1)};
if (relation == ShapeRelation.WITHIN) {
return LongRangeField.newWithinQuery(FIELDNAME, lower, upper);
} else if (relation == ShapeRelation.CONTAINS) {
return LongRangeField.newContainsQuery(FIELDNAME, lower, upper);
}
return LongRangeField.newIntersectsQuery(FIELDNAME, lower, upper);
}
示例4: getFloatRangeQuery
private Query getFloatRangeQuery(ShapeRelation relation, float from, float to, boolean includeLower, boolean includeUpper) {
float[] lower = new float[] {includeLower ? from : Math.nextUp(from)};
float[] upper = new float[] {includeUpper ? to : Math.nextDown(to)};
if (relation == ShapeRelation.WITHIN) {
return FloatRangeField.newWithinQuery(FIELDNAME, lower, upper);
} else if (relation == ShapeRelation.CONTAINS) {
return FloatRangeField.newContainsQuery(FIELDNAME, lower, upper);
}
return FloatRangeField.newIntersectsQuery(FIELDNAME, lower, upper);
}
示例5: getDoubleRangeQuery
private Query getDoubleRangeQuery(ShapeRelation relation, double from, double to, boolean includeLower, boolean includeUpper) {
double[] lower = new double[] {includeLower ? from : Math.nextUp(from)};
double[] upper = new double[] {includeUpper ? to : Math.nextDown(to)};
if (relation == ShapeRelation.WITHIN) {
return DoubleRangeField.newWithinQuery(FIELDNAME, lower, upper);
} else if (relation == ShapeRelation.CONTAINS) {
return DoubleRangeField.newContainsQuery(FIELDNAME, lower, upper);
}
return DoubleRangeField.newIntersectsQuery(FIELDNAME, lower, upper);
}