Repository navigation
DOC-7228 Port the Lettuce semantic-cache and memory-layer demos to the typed FT.* and JSON.* API - #4398
Open
andy-stark-redis wants to merge 2 commits into
Open
DOC-7228 Port the Lettuce semantic-cache and memory-layer demos to the typed FT.* and JSON.* API#4398andy-stark-redis wants to merge 2 commits into
andy-stark-redis wants to merge 2 commits into
Conversation
The demo now pins Lettuce 7.9.0 (was 6.7.1) and uses ftCreate, ftSearch and ftDropindex instead of dispatch() with hand-built CommandArgs, and SearchArgs instead of an alternating reply parsed by position. FT.INFO is the one search command with no typed method in 7.9.0, so indexInfo() still dispatches it. The page said Lettuce 6.7 has no FT.* bindings; that paragraph, the query snippet and the connection snippet are rewritten, and the class javadoc now says which commands are typed. The explicit RESP2 pin is removed. It existed so the hand-written parser saw the flat RESP2 shape, and the typed API parses either protocol. I ran the same driver under RESP2, RESP3 and the default protocol and the results were identical, including the FT.INFO dispatch, which NestedMultiOutput handles in both. MONITOR shows the typed calls send the same FT.SEARCH as before (same RETURN, SORTBY, LIMIT, PARAMS and DIALECT 2). FT.CREATE sends the vector attributes in a different order, which is equivalent. dropIndex tolerates a missing index by message text, and Redis 8.10 words it "SEARCH_INDEX_NOT_FOUND Index not found", so isMissingIndex now covers that wording too. Verified with mvn compile (no deprecation warnings) and a throwaway driver against Redis 8.10.2 with synthetic vectors: dropIndex on a missing index, idempotent createIndex, put, hit, hit_count increment, tenant isolation, far-vector miss, empty-tenant miss, listEntries, indexInfo and clear. The embedding model was not available offline, so LocalEmbedder and the DemoServer HTTP endpoints have not run on 7.9.0. Learned: Lettuce 7.9.0's typed ftSearch replaces the hand-parsed FT.SEARCH reply and works under RESP2 and RESP3, so the RESP2 pin is unnecessary Constraint: FT.INFO has no typed method in Lettuce 7.9.0, so indexInfo() must keep dispatch() with FtCommand.FT_INFO Gaps: LocalEmbedder and the DemoServer endpoints have not run on 7.9.0; only RedisSemanticCache was exercised Recheck: when Lettuce adds a typed ftInfo, replace the FT.INFO dispatch Ticket: DOC-7228 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…SON APIs The demo now pins Lettuce 7.9.0 (was 6.7.1). LongTermMemory uses ftCreate, ftSearch and ftDropindex for Redis Search and jsonSet and jsonNumincrby for Redis JSON, instead of dispatch() with hand-built CommandArgs and a parser that walked the nested reply. JSON.SET still runs inside MULTI/EXEC under the shared txLock, and the typed call queues like any other command. FT.INFO has no typed method in 7.9.0, so indexInfo() still dispatches it. The page claimed Lettuce 6.7 has no FT.* or JSON.* bindings; the overview, the recall and remember steps, the connection snippet and the "Sending FT.* / JSON.* commands" section are rewritten around the typed calls. The explicit RESP2 pin is removed from DemoServer and the page: the typed parser handles both protocols, which I confirmed by running the same driver under RESP2, RESP3 and the default protocol with identical results, and by recording the wire commands with MONITOR (FT.CREATE on a JSON index with the same aliased schema, FT.SEARCH with the same KNN query, RETURN list, SORTBY, LIMIT and DIALECT 2, JSON.SET with the document and JSON.NUMINCRBY on $.hit_count). dropIndex tolerated a missing index only by two message texts, and Redis 8.10 words it "SEARCH_INDEX_NOT_FOUND Index not found", so isMissingIndex now covers that wording too. Verified with mvn compile (no deprecation warnings) and a throwaway driver against Redis 8.10.2 with synthetic vectors: dropIndex on a missing index, idempotent createIndex, remember (new write, same-vector dedupe that bumps hit_count, other user not deduped), recall with its TTL, scope isolation, listMemories, indexInfo, deleteMemory and clear. The embedding model was not available offline, so LocalEmbedder, AgentSession, AgentEventLog and the DemoServer endpoints have not run on 7.9.0. Learned: Lettuce 7.9.0 has typed ftSearch, ftCreate, ftDropindex, jsonSet and jsonNumincrby that work inside MULTI/EXEC and under RESP2 and RESP3 Constraint: FT.INFO has no typed method in Lettuce 7.9.0, so indexInfo() must keep dispatch() with ModuleCommand.FT_INFO Gaps: only LongTermMemory was exercised; LocalEmbedder, AgentSession, AgentEventLog and the DemoServer endpoints have not run on 7.9.0 Recheck: when Lettuce adds a typed ftInfo, replace the FT.INFO dispatch Ticket: DOC-7228 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Contributor
Contributor
🧠 Redis MemoryFound 5 related items from repository history (5 new this commit):
Memory updated at 3433472 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Jira: DOC-7228. Second PR for DOC-7228, after #4397 (recommendation engine and feature store). Based on
main, independent of #4397 and #4396.The semantic-cache and agent-memory demos sent every
FT.*andJSON.*command throughdispatch()with hand-builtCommandArgs, and parsed the replies by position. Their pages said "Lettuce 6.7 doesn't ship first-classFT.*orJSON.*bindings", which stopped being true in 7.0. Both now use the typed API on Lettuce 7.9.0.Changes
RedisSemanticCacheusesftCreate,ftSearchandftDropindexwithCreateArgs,FieldArgsandSearchArgs. The hand-written reply parser is gone.LongTermMemoryuses the same typed search calls plusjsonSetandjsonNumincrby.JSON.SETstill runs insideMULTI/EXECunder the shared lock.FT.INFOstays ondispatch()in both: 7.9.0 has no typedftInfo. The helpers keep a single-entryProtocolKeywordfor it.DemoServers and the pages. It existed so the hand-written parser saw the flat RESP2 shape. The typed parser handles RESP2 and RESP3, and the drivers gave identical results under RESP2, RESP3 and the default protocol (including theFT.INFOdispatch).dropIndexfix: both helpers tolerated a missing index only for "no such index" and "unknown index name". Redis 8.10 saysSEARCH_INDEX_NOT_FOUND Index not found, sodropIndexthrew on a fresh 8.10. A sharedisMissingIndexhelper covers all three wordings.Verification
mvn compileon 7.9.0 with no deprecation warnings.dropIndexon a missing index, idempotentcreateIndex,put, a hit withhit_countincrement and TTL refresh, tenant isolation, a far-vector miss, an empty-tenant miss,listEntries,indexInfoandclear.dropIndex, idempotentcreateIndex,remember(new write, same-vector dedupe that bumpshit_count, other user not deduped),recallwith its TTL, scope isolation,listMemories,indexInfo,deleteMemoryandclear.MONITORshows the typed calls send the sameFT.SEARCHas before (sameRETURN,SORTBY,LIMIT,PARAMSandDIALECT 2), andFT.CREATEwith the same schema (the vector attributes are sent in a different order, which is equivalent). Memory-layer also sendsJSON.SETandJSON.NUMINCRBY $.hit_countas before.Not verified
LocalEmbedderand theDemoServerHTTP endpoints of both demos have not run on 7.9.0. OnlyRedisSemanticCacheandLongTermMemorywere exercised.AgentSessionandAgentEventLogwere not exercised.Still open in DOC-7228
Not in this PR: the manual jar recipes (Netty 4.2.17 and
reactor-core3.8.7) and the remaining pin bumps.Not squashing yet:
/finalizewaits for approval.🤖 Generated with Claude Code
Note
Low Risk
Documentation demo code only; behavior is intended to stay wire-equivalent with broader Redis version compatibility for idempotent index drops.
Overview
Both java-lettuce demos bump Lettuce 6.7.1 → 7.9.0 and stop hand-building Redis Search/JSON via
dispatch()and RESP2-shaped reply parsers.LongTermMemoryandRedisSemanticCachenow use typedftCreate,ftSearch,ftDropindex, and (memory-layer only)jsonSet/jsonNumincrbywithCreateArgs,FieldArgs, andSearchArgs.FT.INFOalone stays ondispatch()because 7.9 has no typed helper. Hand-writtenparseAllHits/fieldsToMaplogic is replaced bySearchReplyandFieldValue.RESP2 pinning is removed from both
DemoServerclasses and the walkthrough pages; the typed client handles RESP2 and RESP3.dropIndextolerates Redis 8.10 missing-index wording via sharedisMissingIndex.Doc pages for semantic-cache and memory-layer are updated to match (connection snippets, query examples, and the section formerly about sending commands through
dispatch()).Reviewed by Cursor Bugbot for commit 3433472. Bugbot is set up for automated code reviews on this repo. Configure here.