@@ -48,8 +48,7 @@ protected RedisProtocol getProtocol() {
4848 }
4949
5050 protected volatile CommandKeyArgumentPreProcessor keyPreProcessor = null ;
51- private JedisBroadcastAndRoundRobinConfig broadcastAndRoundRobinConfig = null ;
52- private Lock mapperLock = new ReentrantLock (true );
51+ private Lock mapperLock = new ReentrantLock (true );
5352 private volatile JsonObjectMapper jsonObjectMapper ;
5453 private final AtomicInteger searchDialect = new AtomicInteger (2 ); // DEFAULT_SEARCH_DIALECT = 2;
5554
@@ -58,10 +57,6 @@ void setKeyArgumentPreProcessor(CommandKeyArgumentPreProcessor keyPreProcessor)
5857 this .keyPreProcessor = keyPreProcessor ;
5958 }
6059
61- void setBroadcastAndRoundRobinConfig (JedisBroadcastAndRoundRobinConfig config ) {
62- this .broadcastAndRoundRobinConfig = config ;
63- }
64-
6560 protected CommandArguments commandArguments (ProtocolCommand command ) {
6661 CommandArguments comArgs = new CommandArguments (command );
6762 if (keyPreProcessor != null ) comArgs .setKeyArgumentPreProcessor (keyPreProcessor );
@@ -2941,7 +2936,7 @@ public final CommandObject<List<Object>> xreadGroup(byte[] groupName, byte[] con
29412936 }
29422937
29432938 public final CommandObject <List <Map .Entry <byte [], List <StreamEntryBinary >>>> xreadGroupBinary (
2944- byte [] groupName , byte [] consumer , XReadGroupParams xReadGroupParams ,
2939+ byte [] groupName , byte [] consumer , XReadGroupParams xReadGroupParams ,
29452940 Map .Entry <byte [], StreamEntryID >... streams ) {
29462941 CommandArguments args = commandArguments (XREADGROUP )
29472942 .add (GROUP ).add (groupName ).add (consumer )
@@ -2956,7 +2951,7 @@ public final CommandObject<List<Map.Entry<byte[], List<StreamEntryBinary>>>> xre
29562951 }
29572952
29582953 public final CommandObject <Map <byte [], List <StreamEntryBinary >>> xreadGroupBinaryAsMap (
2959- byte [] groupName , byte [] consumer , XReadGroupParams xReadGroupParams ,
2954+ byte [] groupName , byte [] consumer , XReadGroupParams xReadGroupParams ,
29602955 Map .Entry <byte [], StreamEntryID >... streams ) {
29612956 CommandArguments args = commandArguments (XREADGROUP )
29622957 .add (GROUP ).add (groupName ).add (consumer )
@@ -3445,18 +3440,16 @@ public final CommandObject<Long> hsetObject(String key, Map<String, Object> hash
34453440 return new CommandObject <>(addFlatMapArgs (commandArguments (HSET ).key (key ), hash ), BuilderFactory .LONG );
34463441 }
34473442
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 ));
34553448 }
34563449
34573450 private CommandArguments checkAndRoundRobinSearchCommand (SearchCommand sc , String idx ) {
34583451 CommandArguments ca = commandArguments (sc );
3459- if (isRoundRobinSearchCommand ()) {
3452+ if (isRoundRobinSearchCommand (sc )) {
34603453 ca .add (idx );
34613454 } else {
34623455 ca .key (idx );
@@ -3466,16 +3459,22 @@ private CommandArguments checkAndRoundRobinSearchCommand(SearchCommand sc, Strin
34663459
34673460 private CommandArguments checkAndRoundRobinSearchCommand (SearchCommand sc , String idx1 , String idx2 ) {
34683461 CommandArguments ca = commandArguments (sc );
3469- if (isRoundRobinSearchCommand ()) {
3462+ if (isRoundRobinSearchCommand (sc )) {
34703463 ca .add (idx1 ).add (idx2 );
34713464 } else {
34723465 ca .key (idx1 ).key (idx2 );
34733466 }
34743467 return ca ;
34753468 }
34763469
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 ;
34793478 }
34803479
34813480 private <T > CommandObject <T > directSearchCommand (CommandObject <T > object , String indexName ) {
@@ -3556,7 +3555,7 @@ public final CommandObject<SearchResult> ftSearch(byte[] indexName, Query query)
35563555 if (protocol == RedisProtocol .RESP3 ) {
35573556 throw new UnsupportedOperationException ("binary ft.search is not implemented with resp3." );
35583557 }
3559- return new CommandObject <>(checkAndRoundRobinSearchCommand (commandArguments ( SearchCommand .SEARCH ) , indexName )
3558+ return new CommandObject <>(checkAndRoundRobinSearchCommand (SearchCommand .SEARCH , indexName )
35603559 .addParams (query .dialectOptional (searchDialect .get ())), getSearchResultBuilder (null ,
35613560 () -> new SearchResultBuilder (!query .getNoContent (), query .getWithScores (), false )));
35623561 }
0 commit comments