DATAREDIS-533 - Polishing.
Remove empty lines after last inner class. Extract duplicate code in variable. Fix spelling. Update Reference Documentation. Remove merge leftovers. Original pull request: #215.
This commit is contained in:
@@ -206,7 +206,7 @@ class IndexWriter {
|
||||
return;
|
||||
}
|
||||
|
||||
else if (indexedData instanceof SimpleIndexedPropertyValue) {
|
||||
if (indexedData instanceof SimpleIndexedPropertyValue) {
|
||||
|
||||
Object value = ((SimpleIndexedPropertyValue) indexedData).getValue();
|
||||
|
||||
@@ -234,9 +234,7 @@ class IndexWriter {
|
||||
|
||||
// keep track of indexes used for the object
|
||||
connection.sAdd(ByteUtils.concatAll(toBytes(indexedData.getKeyspace() + ":"), key, toBytes(":idx")), indexKey);
|
||||
}
|
||||
|
||||
else {
|
||||
} else {
|
||||
throw new IllegalArgumentException(
|
||||
String.format("Cannot write index data for unknown index type %s", indexedData.getClass()));
|
||||
}
|
||||
|
||||
@@ -516,9 +516,9 @@ public class RedisKeyValueAdapter extends AbstractKeyValueAdapter
|
||||
? ByteUtils.concatAll(toBytes(redisUpdateObject.keyspace), toBytes((":" + path)), toBytes(":"), value) : null;
|
||||
|
||||
if (connection.exists(existingValueIndexKey)) {
|
||||
|
||||
redisUpdateObject.addIndexToUpdate(new RedisUpdateObject.Index(existingValueIndexKey, DataType.SET));
|
||||
}
|
||||
|
||||
return redisUpdateObject;
|
||||
}
|
||||
|
||||
@@ -545,13 +545,11 @@ public class RedisKeyValueAdapter extends AbstractKeyValueAdapter
|
||||
}
|
||||
|
||||
String pathToUse = GeoIndexedPropertyValue.geoIndexName(path);
|
||||
if (connection.zRank(ByteUtils.concatAll(toBytes(redisUpdateObject.keyspace), toBytes(":"), toBytes(pathToUse)),
|
||||
toBytes(redisUpdateObject.targetId)) != null) {
|
||||
byte[] existingGeoIndexKey = ByteUtils.concatAll(toBytes(redisUpdateObject.keyspace), toBytes(":"),
|
||||
toBytes(pathToUse));
|
||||
|
||||
redisUpdateObject
|
||||
.addIndexToUpdate(new org.springframework.data.redis.core.RedisKeyValueAdapter.RedisUpdateObject.Index(
|
||||
ByteUtils.concatAll(toBytes(redisUpdateObject.keyspace), toBytes(":"), toBytes(pathToUse)),
|
||||
DataType.ZSET));
|
||||
if (connection.zRank(existingGeoIndexKey, toBytes(redisUpdateObject.targetId)) != null) {
|
||||
redisUpdateObject.addIndexToUpdate(new RedisUpdateObject.Index(existingGeoIndexKey, DataType.ZSET));
|
||||
}
|
||||
|
||||
return redisUpdateObject;
|
||||
|
||||
@@ -90,18 +90,11 @@ class RedisQueryEngine extends QueryEngine<RedisKeyValueAdapter, RedisOperationC
|
||||
@Override
|
||||
public Map<byte[], Map<byte[], byte[]>> doInRedis(RedisConnection connection) throws DataAccessException {
|
||||
|
||||
String key = keyspace + ":";
|
||||
byte[][] keys = new byte[criteria.getSismember().size()][];
|
||||
int i = 0;
|
||||
for (Object o : criteria.getSismember()) {
|
||||
keys[i] = getAdapter().getConverter().getConversionService().convert(key + o, byte[].class);
|
||||
i++;
|
||||
}
|
||||
|
||||
List<byte[]> allKeys = new ArrayList<byte[]>();
|
||||
if (!criteria.getSismember().isEmpty()) {
|
||||
allKeys.addAll(connection.sInter(keys(keyspace + ":", criteria.getSismember())));
|
||||
}
|
||||
|
||||
if (!criteria.getOrSismember().isEmpty()) {
|
||||
allKeys.addAll(connection.sUnion(keys(keyspace + ":", criteria.getOrSismember())));
|
||||
}
|
||||
@@ -229,5 +222,4 @@ class RedisQueryEngine extends QueryEngine<RedisKeyValueAdapter, RedisOperationC
|
||||
return (RedisOperationChain) query.getCritieria();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -81,5 +81,4 @@ class IndexedDataFactoryProvider {
|
||||
(Point) indexDefinition.valueTransformer().convert(value));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.springframework.data.geo.Point;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
/**
|
||||
* Simple set of operations requried to run queries against Redis.
|
||||
* Simple set of operations required to run queries against Redis.
|
||||
*
|
||||
* @author Christoph Strobl
|
||||
* @since 1.7
|
||||
@@ -36,7 +36,6 @@ public class RedisOperationChain {
|
||||
|
||||
private Set<PathAndValue> sismember = new LinkedHashSet<PathAndValue>();
|
||||
private Set<PathAndValue> orSismember = new LinkedHashSet<PathAndValue>();
|
||||
|
||||
private NearPath near;
|
||||
|
||||
public void sismember(String path, Object value) {
|
||||
@@ -163,5 +162,4 @@ public class RedisOperationChain {
|
||||
return (Distance) it.next();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -41,7 +41,6 @@ public class RedisQueryCreator extends AbstractQueryCreator<KeyValueQuery<RedisO
|
||||
|
||||
public RedisQueryCreator(PartTree tree, ParameterAccessor parameters) {
|
||||
super(tree, parameters);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -68,7 +67,6 @@ public class RedisQueryCreator extends AbstractQueryCreator<KeyValueQuery<RedisO
|
||||
}
|
||||
|
||||
return sink;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -150,5 +148,4 @@ public class RedisQueryCreator extends AbstractQueryCreator<KeyValueQuery<RedisO
|
||||
|
||||
return new NearPath(part.getProperty().toDotPath(), point, distance);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user