The `get` method of `RedisChatMemoryRepository` only returns data of type `USER`

Open Beginner friendly
#5,670 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
64/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
java, redis
Domain
backend, databases

Research direction

Start at RedisChatMemoryRepository#get(String, int) and inspect the Redis index schema around schemaFields.add(...). Reproduce the search with the supplied redis-cli commands and verify that both USER and ASSISTANT records are returned; done is a query that returns both types.

Written by the indexing model from the issue text.

Description

status: waiting-for-triage

Bug description
Suspected that there was a problem with creating the index
schemaFields.add(new TextField("$.type").as("type"));
I think need change to TagField like
schemaFields.add(new TagField ("$.type").as("type"));

Environment
springboot 4.0.4
spirng ai 2.0.0-M3

Steps to reproduce

  1. AI and I have a conversation. Redis stores two pieces of data, one of type user and the other of type ASSISTANT, but org.springframework.ai.chat.memory.repository.redis.RedisChatMemoryRepository#get(java.lang.String, int) The method only returned one piece of data, of type user
  2. Then I checked and found out that the type was text, so I manually created the index and returned it correctly
#One click repair
redis-cli FT.DROPINDEX my-chat-index
redis-cli FT.CREATE my-chat-index ON JSON PREFIX 1 "my-chat:" SCHEMA $.conversation_id AS conversation_id TAG $.type AS type TAG $.content AS content TEXT $.timestamp AS timestamp NUMERIC SORTABLE
#Verification
redis-cli FT.SEARCH my-chat-index "@conversation_id:{1}"

Expected behavior

Minimal Complete Reproducible example

Image
Dominant language
Java
Stars
9.5k
Forks
2.9k
Avg merge
1d 10h
Merged PRs (30d)
5

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from spring-projects/spring-ai

All issues in spring-projects/spring-ai

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.