@@ -48,8 +48,7 @@ protected RedisProtocol getProtocol() {
48
48
}
49
49
50
50
protected volatile CommandKeyArgumentPreProcessor keyPreProcessor = null ;
51
- private JedisBroadcastAndRoundRobinConfig broadcastAndRoundRobinConfig = null ;
52
- private Lock mapperLock = new ReentrantLock (true );
51
+ private Lock mapperLock = new ReentrantLock (true );
53
52
private volatile JsonObjectMapper jsonObjectMapper ;
54
53
private final AtomicInteger searchDialect = new AtomicInteger (2 ); // DEFAULT_SEARCH_DIALECT = 2;
55
54
@@ -58,10 +57,6 @@ void setKeyArgumentPreProcessor(CommandKeyArgumentPreProcessor keyPreProcessor)
58
57
this .keyPreProcessor = keyPreProcessor ;
59
58
}
60
59
61
- void setBroadcastAndRoundRobinConfig (JedisBroadcastAndRoundRobinConfig config ) {
62
- this .broadcastAndRoundRobinConfig = config ;
63
- }
64
-
65
60
protected CommandArguments commandArguments (ProtocolCommand command ) {
66
61
CommandArguments comArgs = new CommandArguments (command );
67
62
if (keyPreProcessor != null ) comArgs .setKeyArgumentPreProcessor (keyPreProcessor );
@@ -2941,7 +2936,7 @@ public final CommandObject<List<Object>> xreadGroup(byte[] groupName, byte[] con
2941
2936
}
2942
2937
2943
2938
public final CommandObject <List <Map .Entry <byte [], List <StreamEntryBinary >>>> xreadGroupBinary (
2944
- byte [] groupName , byte [] consumer , XReadGroupParams xReadGroupParams ,
2939
+ byte [] groupName , byte [] consumer , XReadGroupParams xReadGroupParams ,
2945
2940
Map .Entry <byte [], StreamEntryID >... streams ) {
2946
2941
CommandArguments args = commandArguments (XREADGROUP )
2947
2942
.add (GROUP ).add (groupName ).add (consumer )
@@ -2956,7 +2951,7 @@ public final CommandObject<List<Map.Entry<byte[], List<StreamEntryBinary>>>> xre
2956
2951
}
2957
2952
2958
2953
public final CommandObject <Map <byte [], List <StreamEntryBinary >>> xreadGroupBinaryAsMap (
2959
- byte [] groupName , byte [] consumer , XReadGroupParams xReadGroupParams ,
2954
+ byte [] groupName , byte [] consumer , XReadGroupParams xReadGroupParams ,
2960
2955
Map .Entry <byte [], StreamEntryID >... streams ) {
2961
2956
CommandArguments args = commandArguments (XREADGROUP )
2962
2957
.add (GROUP ).add (groupName ).add (consumer )
@@ -3445,18 +3440,16 @@ public final CommandObject<Long> hsetObject(String key, Map<String, Object> hash
3445
3440
return new CommandObject <>(addFlatMapArgs (commandArguments (HSET ).key (key ), hash ), BuilderFactory .LONG );
3446
3441
}
3447
3442
3448
- private boolean isRoundRobinSearchCommand () {
3449
- if (broadcastAndRoundRobinConfig == null ) {
3450
- return true ;
3451
- } else if (broadcastAndRoundRobinConfig .getRediSearchModeInCluster () == JedisBroadcastAndRoundRobinConfig .RediSearchMode .LIGHT ) {
3452
- return false ;
3453
- }
3454
- return true ;
3443
+ private boolean isRoundRobinSearchCommand (SearchCommand sc ) {
3444
+
3445
+ return !(sc .equals (SearchCommand .SUGGET ) || sc .equals (SearchCommand .SUGADD ) || sc .equals (
3446
+ SearchCommand .SUGLEN ) || sc .equals (SearchCommand .SUGDEL ) || sc .equals (
3447
+ SearchCommand .CURSOR ));
3455
3448
}
3456
3449
3457
3450
private CommandArguments checkAndRoundRobinSearchCommand (SearchCommand sc , String idx ) {
3458
3451
CommandArguments ca = commandArguments (sc );
3459
- if (isRoundRobinSearchCommand ()) {
3452
+ if (isRoundRobinSearchCommand (sc )) {
3460
3453
ca .add (idx );
3461
3454
} else {
3462
3455
ca .key (idx );
@@ -3466,16 +3459,22 @@ private CommandArguments checkAndRoundRobinSearchCommand(SearchCommand sc, Strin
3466
3459
3467
3460
private CommandArguments checkAndRoundRobinSearchCommand (SearchCommand sc , String idx1 , String idx2 ) {
3468
3461
CommandArguments ca = commandArguments (sc );
3469
- if (isRoundRobinSearchCommand ()) {
3462
+ if (isRoundRobinSearchCommand (sc )) {
3470
3463
ca .add (idx1 ).add (idx2 );
3471
3464
} else {
3472
3465
ca .key (idx1 ).key (idx2 );
3473
3466
}
3474
3467
return ca ;
3475
3468
}
3476
3469
3477
- private CommandArguments checkAndRoundRobinSearchCommand (CommandArguments commandArguments , byte [] indexName ) {
3478
- return isRoundRobinSearchCommand () ? commandArguments .add (indexName ) : commandArguments .key (indexName );
3470
+ private CommandArguments checkAndRoundRobinSearchCommand (SearchCommand sc , byte [] indexName ) {
3471
+ CommandArguments ca = commandArguments (sc );
3472
+ if (isRoundRobinSearchCommand (sc )) {
3473
+ ca .add (indexName );
3474
+ } else {
3475
+ ca .key (indexName );
3476
+ }
3477
+ return ca ;
3479
3478
}
3480
3479
3481
3480
private <T > CommandObject <T > directSearchCommand (CommandObject <T > object , String indexName ) {
@@ -3556,7 +3555,7 @@ public final CommandObject<SearchResult> ftSearch(byte[] indexName, Query query)
3556
3555
if (protocol == RedisProtocol .RESP3 ) {
3557
3556
throw new UnsupportedOperationException ("binary ft.search is not implemented with resp3." );
3558
3557
}
3559
- return new CommandObject <>(checkAndRoundRobinSearchCommand (commandArguments ( SearchCommand .SEARCH ) , indexName )
3558
+ return new CommandObject <>(checkAndRoundRobinSearchCommand (SearchCommand .SEARCH , indexName )
3560
3559
.addParams (query .dialectOptional (searchDialect .get ())), getSearchResultBuilder (null ,
3561
3560
() -> new SearchResultBuilder (!query .getNoContent (), query .getWithScores (), false )));
3562
3561
}
0 commit comments