@@ -4494,8 +4494,10 @@ public void setDefaultSearchDialect(int dialect) {
4494
4494
4495
4495
private class SearchProfileResponseBuilder <T > extends Builder <Map .Entry <T , ProfilingInfo >> {
4496
4496
4497
- private static final String PROFILE_STR = "profile" ;
4498
- private static final String RESULTS_STR = "results" ;
4497
+ private static final String PROFILE_STR_REDIS7 = "profile" ;
4498
+ private static final String PROFILE_STR_REDIS8 = "Profile" ;
4499
+ private static final String RESULTS_STR_REDIS7 = "results" ;
4500
+ private static final String RESULTS_STR_REDIS8 = "Results" ;
4499
4501
4500
4502
private final Builder <T > resultsBuilder ;
4501
4503
@@ -4512,22 +4514,32 @@ public Map.Entry<T, ProfilingInfo> build(Object data) {
4512
4514
System .out .println ("<<<<<<<<<<<<<<<<<<<<DEBUG" );
4513
4515
4514
4516
if (list .get (0 ) instanceof KeyValue ) { // RESP3
4515
- Object resultsRaw = data ;
4516
- Object profileRaw = null ;
4517
+ Object resultsData = null , profileData = null ;
4518
+
4517
4519
for (KeyValue keyValue : (List <KeyValue >) data ) {
4518
4520
String keyStr = BuilderFactory .STRING .build (keyValue .getKey ());
4519
- if (PROFILE_STR .equalsIgnoreCase (keyStr )) {
4520
- profileRaw = keyValue .getValue ();
4521
- // } else if (RESULTS_STR.equalsIgnoreCase(keyStr)) { // Redis 8
4522
- // resultsRaw = keyValue.getValue();
4521
+ switch (keyStr ) {
4522
+ case PROFILE_STR_REDIS7 :
4523
+ case PROFILE_STR_REDIS8 :
4524
+ profileData = keyValue .getValue ();
4525
+ break ;
4526
+ case RESULTS_STR_REDIS7 :
4527
+ resultsData = data ;
4528
+ break ;
4529
+ case RESULTS_STR_REDIS8 :
4530
+ resultsData = keyValue .getValue ();
4531
+ break ;
4523
4532
}
4524
4533
}
4525
- return KeyValue .of (resultsBuilder .build (resultsRaw ),
4526
- ProfilingInfo .PROFILING_INFO_BUILDER .build (profileRaw ));
4534
+
4535
+ assert resultsData != null : "Could not detect Results data." ;
4536
+ assert profileData != null : "Could not detect Profile data." ;
4537
+ return KeyValue .of (resultsBuilder .build (resultsData ),
4538
+ ProfilingInfo .PROFILING_INFO_BUILDER .build (profileData ));
4527
4539
}
4528
4540
4529
4541
return KeyValue .of (resultsBuilder .build (list .get (0 )),
4530
- ProfilingInfo .PROFILING_INFO_BUILDER .build (list .get (1 ))); // RESP2
4542
+ ProfilingInfo .PROFILING_INFO_BUILDER .build (list .get (1 )));
4531
4543
}
4532
4544
}
4533
4545
0 commit comments