public Scanner<T> filter(String nameOfField, boolean fieldValue) { setIndexName(type, setName, namespace, nameOfField); if (!boolean.class.isAssignableFrom(field.getType()) && !Boolean.class.isAssignableFrom(field.getType())) { throw new SpikeifyError("Can't query with boolean filter on: " + type + "#" + nameOfField + ", not a boolean field!"); } IndexCollectionType collectionType = IndexingService.getIndexCollectionType(type, field.getName()); if (IndexCollectionType.DEFAULT.equals(collectionType)) { return setFilters(Filter.equal(fieldName, fieldValue ? 1 : 0)); } return setFilters(Filter.contains(fieldName, collectionType, fieldValue ? 1 : 0)); }
public Scanner<T> filter(String nameOfField, long begin, long end) { setIndexName(type, setName, namespace, nameOfField); IndexCollectionType collectionType = IndexingService.getIndexCollectionType(type, field.getName()); if (IndexCollectionType.DEFAULT.equals(collectionType)) { return setFilters(Filter.range(fieldName, begin, end)); } return setFilters(Filter.range(fieldName, collectionType, begin, end)); }
/** * Create string equality filter for query. * * @param name bin name * @param value filter value * @return filter instance */ public static Filter equal(String name, String value) { Value val = Value.get(value); return new Filter(name, IndexCollectionType.DEFAULT, val.getType(), val, val); }
case EQ: if (getValue1().getType() == ParticleType.INTEGER) return Filter.equal(getField(), getValue1().toLong()); else return Filter.equal(getField(), getValue1().toString()); case GTEQ: case BETWEEN: return Filter.range(getField(), getValue1().toLong(), getValue2()==null?Long.MAX_VALUE:getValue2().toLong()); case GT: return Filter.range(getField(), getValue1().toLong()+1, getValue2()==null?Long.MAX_VALUE:getValue2().toLong()); case LT: return Filter.range(getField(), Long.MIN_VALUE, getValue1().toLong()-1); case LTEQ: return Filter.range(getField(), Long.MIN_VALUE, getValue1().toLong()+1); case LIST_CONTAINS: return collectionContains(IndexCollectionType.LIST);
@Override public long getCommittedWindowId(String appId, int operatorId) { try { lastWindowFetchCommand.setFilters(Filter.equal(metaTableOperatorIdColumn, operatorId)); lastWindowFetchCommand.setFilters(Filter.equal(metaTableAppIdColumn, appId)); long lastWindow = -1; RecordSet recordSet = client.query(null, lastWindowFetchCommand); while(recordSet.next()) { lastWindow = Long.parseLong(recordSet.getRecord().getValue(metaTableWindowColumn).toString()); } return lastWindow; } catch (AerospikeException ex) { throw new RuntimeException(ex); } }
private Filter collectionContains(IndexCollectionType collectionType) { Value val = getValue1(); int valType = val.getType(); switch (valType) { case ParticleType.INTEGER: return Filter.contains(getField(), collectionType, val.toLong()); case ParticleType.STRING: return Filter.contains(getField(), collectionType, val.toString()); } return null; }
IndexCollectionType type = filter.getCollectionType(); filterSize += filter.estimateSize(); IndexCollectionType type = filter.getCollectionType(); dataOffset = filter.write(dataBuffer, dataOffset);
private Filter geoWithinRadius(IndexCollectionType collectionType) { return Filter.geoContains(getField(), getValue1().toString()); }
stmt.setSetName(params.set); stmt.setBinNames(binName); stmt.setFilter(Filter.geoWithinRadius(binName, lon, lat, radius));
@Override public long getCommittedWindowId(String appId, int operatorId) { try { lastWindowFetchCommand.setFilters(Filter.equal(metaTableOperatorIdColumn, operatorId)); lastWindowFetchCommand.setFilters(Filter.equal(metaTableAppIdColumn, appId)); long lastWindow = -1; RecordSet recordSet = client.query(null, lastWindowFetchCommand); while (recordSet.next()) { lastWindow = Long.parseLong(recordSet.getRecord().getValue(metaTableWindowColumn).toString()); } return lastWindow; } catch (AerospikeException ex) { throw new RuntimeException(ex); } }
stmt.setSetName(params.set); stmt.setBinNames(binName); stmt.setFilter(Filter.contains(binName, IndexCollectionType.MAPKEYS, queryMapKey));
IndexCollectionType type = filter.getCollectionType(); filterSize += filter.estimateSize(); IndexCollectionType type = filter.getCollectionType(); dataOffset = filter.write(dataBuffer, dataOffset);
public Scanner<T> filter(String nameOfField, String fieldValue) { setIndexName(type, setName, namespace, nameOfField); IndexCollectionType collectionType = IndexingService.getIndexCollectionType(type, field.getName()); if (IndexCollectionType.DEFAULT.equals(collectionType)) { return setFilters(Filter.equal(fieldName, fieldValue)); } return setFilters(Filter.contains(fieldName, collectionType, fieldValue)); }
private Filter collectionRange(IndexCollectionType collectionType) { return Filter.range(getField(), collectionType, getValue1().toLong(), getValue2().toLong()); }
stmt.setSetName(params.set); stmt.setBinNames(binName); stmt.setFilter(Filter.equal(binName, filter));
/** * Create geospatial "containing point" filter for query. * * @param name bin name * @param point GeoJSON point * @return filter instance */ public static Filter geoContains(String name, String point) { return new Filter(name, IndexCollectionType.DEFAULT, ParticleType.GEOJSON, Value.get(point), Value.get(point)); }
public Scanner<T> filter(String nameOfField, long fieldValue) { setIndexName(type, setName, namespace, nameOfField); IndexCollectionType collectionType = IndexingService.getIndexCollectionType(type, field.getName()); if (IndexCollectionType.DEFAULT.equals(collectionType)) { return setFilters(Filter.equal(fieldName, fieldValue)); } return setFilters(Filter.contains(fieldName, collectionType, fieldValue)); }
stmt.setSetName(params.set); stmt.setBinNames(binName); stmt.setFilter(Filter.range(binName, begin, end));
stmt.setNamespace(params.namespace); stmt.setSetName(params.set); stmt.setFilter(Filter.equal(binName, nameFilter)); stmt.setAggregateFunction("filter_example", "profile_filter", Value.get(passFilter));
/** * Create geospatial "containing point" filter for query on collection index. * * @param name bin name * @param type index collection type * @param point GeoJSON point. * @return filter instance */ public static Filter geoContains(String name, IndexCollectionType type, String point) { return new Filter(name, type, ParticleType.GEOJSON, Value.get(point), Value.get(point)); }