Conversation
Implements FT.INFO command to retrieve index information from RediSearch. Returns a strongly-typed IndexInfo object instead of Map<String, Object> for better type safety and developer experience. Changes: - Add IndexInfo class with comprehensive index metadata - Add IndexInfoParser supporting RESP2 and RESP3 protocols - Implement ftInfo across all API layers (sync, async, reactive, coroutines) - Add unit tests for IndexInfo class - Update integration tests
- Changed IndexInfo from IndexInfo<K, V> to IndexInfo<V> - Index name is now always String type (decoded with StringCodec) - Updated all ftInfo method signatures across all command interfaces - Updated IndexInfoParser to decode index name as String - Updated all tests to use new signature - Removed IndexInfoParserUnitTests (integration tests provide better coverage) All integration tests passing (testFtInfoCommand*)
- Handle case where parseListValue already parsed ComplexData into List - Add support for String values in parseLong, parseDouble, and parseBoolean methods - Fix parsing of field flags when SORTABLE has a flag as its value (e.g., SORTABLE NOSTEM) - Update getBoolean to decode non-String flag values using decodeStringAsString - Add isFieldFlag helper method to identify known field flags
da2321a to
2e197bf
Compare
|
@a-TODO-rov went over the review and did some polishing myself:
IMHO we are good to go |
🛡️ Jit Security Scan Results✅ No security findings were detected in this PR
Security scan by Jit
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
| private IndexInfo.TextField<V> createTextField(V identifier, V attribute, boolean sortable, boolean unNormalizedForm, | ||
| boolean noIndex, boolean indexEmpty, boolean indexMissing, Map<String, Object> attributeMap, | ||
| Map<String, Object> additionalFields) { | ||
| Double weight = parseDouble(attributeMap.get(FLAG_WEIGHT)); |
There was a problem hiding this comment.
TextField weight always 0.0, never null when absent
Medium Severity
createTextField uses parseDouble(attributeMap.get(FLAG_WEIGHT)) which returns primitive double (defaulting to 0.0 when the key is absent). This gets autoboxed to Double.valueOf(0.0), so TextField.getWeight() never returns null — contradicting its documented contract of "or null if not set." The getDouble helper method already exists and correctly returns null for missing keys, so it looks like it was meant to be used here instead of parseDouble.
Additional Locations (1)
| && !key.equals(FLAG_NOINDEX) && !key.equals(FLAG_INDEXEMPTY) && !key.equals(FLAG_INDEXMISSING)) { | ||
| vectorAttributes.put(key, entry.getValue()); | ||
| } | ||
| } |
There was a problem hiding this comment.
RESP3 flags key leaks into vector attributes
Low Severity
In createVectorField, the exclusion list when building vectorAttributes does not include ATTR_FLAGS ("flags"). In RESP3, the attribute map contains a flags key with a List value (e.g., ["SORTABLE", "NOINDEX"]). This list is incorrectly included in vectorAttributes alongside actual vector attributes like DIM and DISTANCE_METRIC, polluting the map that VectorField.getAttributes() returns to callers.


This PR implements the FT.INFO command to retrieve index information from RediSearch.
The implementation returns a IndexInfo object.
Changes:
Testing:
All unit tests pass. Integration tests require a Redis instance with RediSearch module.
Note
Medium Risk
Adds a new RediSearch command with a large, protocol-sensitive RESP2/RESP3 parser and new data model; main risk is incorrect parsing/mapping of server responses across Redis/RediSearch versions.
Overview
Adds support for RediSearch
FT.INFOacross sync/async/reactive/coroutines (including cluster node-selection) APIs, returning a new strongly-typedIndexInforesult.Introduces
IndexInfoplusIndexInfoParserand wires them intoRediSearchCommandBuilderviaCommandType.FT_INFO, with extensive unit coverage to validate parsing for RESP2/RESP3, field schemas, and statistics/error sections.Written by Cursor Bugbot for commit 2e197bf. This will update automatically on new commits. Configure here.