@Override public Query createQuery() { final int size = fieldContexts.size(); if (size == 1) { return queryCustomizer.setWrappedQuery(createQuery(fieldContexts.get(0))).createQuery(); } else { BooleanQuery.Builder aggregatedFieldsQueryBuilder = new BooleanQuery.Builder(); for (FieldContext fieldContext : fieldContexts) { aggregatedFieldsQueryBuilder.add(createQuery(fieldContext), BooleanClause.Occur.SHOULD); } BooleanQuery aggregatedFieldsQuery = aggregatedFieldsQueryBuilder.build(); return queryCustomizer.setWrappedQuery(aggregatedFieldsQuery).createQuery(); } }
public ConnectedSpatialContext(QueryBuildingContext context, ConnectedQueryBuilder queryBuilder) { this.queryContext = context; this.queryCustomizer = new QueryCustomizer(); // today we only do constant score for spatial queries queryCustomizer.withConstantScore(); spatialContext = new SpatialQueryContext(); this.queryBuilder = queryBuilder; }
@Override public SpatialContext filteredBy(Filter filter) { queryCustomizer.filteredBy(filter); return this; }
@Override public SpatialContext withConstantScore() { queryCustomizer.withConstantScore(); return this; }
@Override public SpatialContext boostedTo(float boost) { queryCustomizer.boostedTo(boost); return this; }