19
19
import redis .clients .jedis .bloom .*;
20
20
import redis .clients .jedis .bloom .RedisBloomProtocol .*;
21
21
import redis .clients .jedis .commands .ProtocolCommand ;
22
- import redis .clients .jedis .gears .*;
23
- import redis .clients .jedis .gears .RedisGearsProtocol .*;
24
- import redis .clients .jedis .gears .resps .GearsLibraryInfo ;
25
- import redis .clients .jedis .graph .GraphProtocol .*;
26
22
import redis .clients .jedis .json .*;
27
23
import redis .clients .jedis .json .JsonProtocol .JsonCommand ;
28
24
import redis .clients .jedis .json .DefaultGsonObjectMapper ;
@@ -3437,7 +3433,7 @@ public final CommandObject<String> ftCursorDel(String indexName, long cursorId)
3437
3433
.key (indexName ).add (cursorId ), BuilderFactory .STRING );
3438
3434
}
3439
3435
3440
- public final CommandObject <Map .Entry <AggregationResult , Map < String , Object > >> ftProfileAggregate (
3436
+ public final CommandObject <Map .Entry <AggregationResult , ProfilingInfo >> ftProfileAggregate (
3441
3437
String indexName , FTProfileParams profileParams , AggregationBuilder aggr ) {
3442
3438
return new CommandObject <>(checkAndRoundRobinSearchCommand (SearchCommand .PROFILE , indexName )
3443
3439
.add (SearchKeyword .AGGREGATE ).addParams (profileParams ).add (SearchKeyword .QUERY )
@@ -3446,7 +3442,7 @@ public final CommandObject<Map.Entry<AggregationResult, Map<String, Object>>> ft
3446
3442
: AggregationResult .SEARCH_AGGREGATION_RESULT_WITH_CURSOR ));
3447
3443
}
3448
3444
3449
- public final CommandObject <Map .Entry <SearchResult , Map < String , Object > >> ftProfileSearch (
3445
+ public final CommandObject <Map .Entry <SearchResult , ProfilingInfo >> ftProfileSearch (
3450
3446
String indexName , FTProfileParams profileParams , Query query ) {
3451
3447
return new CommandObject <>(checkAndRoundRobinSearchCommand (SearchCommand .PROFILE , indexName )
3452
3448
.add (SearchKeyword .SEARCH ).addParams (profileParams ).add (SearchKeyword .QUERY )
@@ -3455,7 +3451,7 @@ public final CommandObject<Map.Entry<SearchResult, Map<String, Object>>> ftProfi
3455
3451
() -> new SearchResultBuilder (!query .getNoContent (), query .getWithScores (), true ))));
3456
3452
}
3457
3453
3458
- public final CommandObject <Map .Entry <SearchResult , Map < String , Object > >> ftProfileSearch (
3454
+ public final CommandObject <Map .Entry <SearchResult , ProfilingInfo >> ftProfileSearch (
3459
3455
String indexName , FTProfileParams profileParams , String query , FTSearchParams searchParams ) {
3460
3456
return new CommandObject <>(checkAndRoundRobinSearchCommand (SearchCommand .PROFILE , indexName )
3461
3457
.add (SearchKeyword .SEARCH ).addParams (profileParams ).add (SearchKeyword .QUERY ).add (query )
@@ -4385,70 +4381,6 @@ public final CommandObject<List<Double>> tdigestByRevRank(String key, long... ra
4385
4381
}
4386
4382
// RedisBloom commands
4387
4383
4388
- // RedisGraph commands
4389
- @ Deprecated
4390
- public final CommandObject <List <String >> graphList () {
4391
- return new CommandObject <>(commandArguments (GraphCommand .LIST ), BuilderFactory .STRING_LIST );
4392
- }
4393
-
4394
- @ Deprecated
4395
- public final CommandObject <List <String >> graphProfile (String graphName , String query ) {
4396
- return new CommandObject <>(commandArguments (GraphCommand .PROFILE ).key (graphName ).add (query ), BuilderFactory .STRING_LIST );
4397
- }
4398
-
4399
- @ Deprecated
4400
- public final CommandObject <List <String >> graphExplain (String graphName , String query ) {
4401
- return new CommandObject <>(commandArguments (GraphCommand .EXPLAIN ).key (graphName ).add (query ), BuilderFactory .STRING_LIST );
4402
- }
4403
-
4404
- @ Deprecated
4405
- public final CommandObject <List <List <Object >>> graphSlowlog (String graphName ) {
4406
- return new CommandObject <>(commandArguments (GraphCommand .SLOWLOG ).key (graphName ), BuilderFactory .ENCODED_OBJECT_LIST_LIST );
4407
- }
4408
-
4409
- @ Deprecated
4410
- public final CommandObject <String > graphConfigSet (String configName , Object value ) {
4411
- return new CommandObject <>(commandArguments (GraphCommand .CONFIG ).add (GraphKeyword .SET ).add (configName ).add (value ), BuilderFactory .STRING );
4412
- }
4413
-
4414
- @ Deprecated
4415
- public final CommandObject <Map <String , Object >> graphConfigGet (String configName ) {
4416
- return new CommandObject <>(commandArguments (GraphCommand .CONFIG ).add (GraphKeyword .GET ).add (configName ), BuilderFactory .ENCODED_OBJECT_MAP );
4417
- }
4418
- // RedisGraph commands
4419
-
4420
- // RedisGears commands
4421
- @ Deprecated
4422
- public final CommandObject <String > tFunctionLoad (String libraryCode , TFunctionLoadParams params ) {
4423
- return new CommandObject <>(commandArguments (GearsCommand .TFUNCTION ).add (GearsKeyword .LOAD )
4424
- .addParams (params ).add (libraryCode ), BuilderFactory .STRING );
4425
- }
4426
-
4427
- @ Deprecated
4428
- public final CommandObject <String > tFunctionDelete (String libraryName ) {
4429
- return new CommandObject <>(commandArguments (GearsCommand .TFUNCTION ).add (GearsKeyword .DELETE )
4430
- .add (libraryName ), BuilderFactory .STRING );
4431
- }
4432
-
4433
- @ Deprecated
4434
- public final CommandObject <List <GearsLibraryInfo >> tFunctionList (TFunctionListParams params ) {
4435
- return new CommandObject <>(commandArguments (GearsCommand .TFUNCTION ).add (GearsKeyword .LIST )
4436
- .addParams (params ), GearsLibraryInfo .GEARS_LIBRARY_INFO_LIST );
4437
- }
4438
-
4439
- @ Deprecated
4440
- public final CommandObject <Object > tFunctionCall (String library , String function , List <String > keys , List <String > args ) {
4441
- return new CommandObject <>(commandArguments (GearsCommand .TFCALL ).add (library + "." + function )
4442
- .add (keys .size ()).keys (keys ).addObjects (args ), BuilderFactory .AGGRESSIVE_ENCODED_OBJECT );
4443
- }
4444
-
4445
- @ Deprecated
4446
- public final CommandObject <Object > tFunctionCallAsync (String library , String function , List <String > keys , List <String > args ) {
4447
- return new CommandObject <>(commandArguments (GearsCommand .TFCALLASYNC ).add (library + "." + function )
4448
- .add (keys .size ()).keys (keys ).addObjects (args ), BuilderFactory .AGGRESSIVE_ENCODED_OBJECT );
4449
- }
4450
- // RedisGears commands
4451
-
4452
4384
// Transaction commands
4453
4385
public final CommandObject <String > watch (String ... keys ) {
4454
4386
return new CommandObject <>(commandArguments (WATCH ).keys ((Object []) keys ), BuilderFactory .STRING );
@@ -4496,32 +4428,51 @@ public void setDefaultSearchDialect(int dialect) {
4496
4428
this .searchDialect .set (dialect );
4497
4429
}
4498
4430
4499
- private class SearchProfileResponseBuilder <T > extends Builder <Map .Entry <T , Map < String , Object > >> {
4431
+ private class SearchProfileResponseBuilder <T > extends Builder <Map .Entry <T , ProfilingInfo >> {
4500
4432
4501
- private static final String PROFILE_STR = "profile" ;
4433
+ private static final String PROFILE_STR_REDIS7 = "profile" ;
4434
+ private static final String PROFILE_STR_REDIS8 = "Profile" ;
4435
+ private static final String RESULTS_STR_REDIS7 = "results" ;
4436
+ private static final String RESULTS_STR_REDIS8 = "Results" ;
4502
4437
4503
- private final Builder <T > replyBuilder ;
4438
+ private final Builder <T > resultsBuilder ;
4504
4439
4505
- public SearchProfileResponseBuilder (Builder <T > replyBuilder ) {
4506
- this .replyBuilder = replyBuilder ;
4440
+ public SearchProfileResponseBuilder (Builder <T > resultsBuilder ) {
4441
+ this .resultsBuilder = resultsBuilder ;
4507
4442
}
4508
4443
4509
4444
@ Override
4510
- public Map .Entry <T , Map < String , Object > > build (Object data ) {
4445
+ public Map .Entry <T , ProfilingInfo > build (Object data ) {
4511
4446
List list = (List ) data ;
4512
4447
if (list == null || list .isEmpty ()) return null ;
4513
4448
4514
- if (list .get (0 ) instanceof KeyValue ) {
4449
+ if (list .get (0 ) instanceof KeyValue ) { // RESP3
4450
+ Object resultsData = null , profileData = null ;
4451
+
4515
4452
for (KeyValue keyValue : (List <KeyValue >) data ) {
4516
- if (PROFILE_STR .equals (BuilderFactory .STRING .build (keyValue .getKey ()))) {
4517
- return KeyValue .of (replyBuilder .build (data ),
4518
- BuilderFactory .AGGRESSIVE_ENCODED_OBJECT_MAP .build (keyValue .getValue ()));
4453
+ String keyStr = BuilderFactory .STRING .build (keyValue .getKey ());
4454
+ switch (keyStr ) {
4455
+ case PROFILE_STR_REDIS7 :
4456
+ case PROFILE_STR_REDIS8 :
4457
+ profileData = keyValue .getValue ();
4458
+ break ;
4459
+ case RESULTS_STR_REDIS7 :
4460
+ resultsData = data ;
4461
+ break ;
4462
+ case RESULTS_STR_REDIS8 :
4463
+ resultsData = keyValue .getValue ();
4464
+ break ;
4519
4465
}
4520
4466
}
4467
+
4468
+ assert resultsData != null : "Could not detect Results data." ;
4469
+ assert profileData != null : "Could not detect Profile data." ;
4470
+ return KeyValue .of (resultsBuilder .build (resultsData ),
4471
+ ProfilingInfo .PROFILING_INFO_BUILDER .build (profileData ));
4521
4472
}
4522
4473
4523
- return KeyValue .of (replyBuilder .build (list .get (0 )),
4524
- SearchBuilderFactory . SEARCH_PROFILE_PROFILE .build (list .get (1 )));
4474
+ return KeyValue .of (resultsBuilder .build (list .get (0 )),
4475
+ ProfilingInfo . PROFILING_INFO_BUILDER .build (list .get (1 )));
4525
4476
}
4526
4477
}
4527
4478
0 commit comments