Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

why search vector param byte[] is error #57

Open
zymgg opened this issue Jun 20, 2024 · 0 comments
Open

why search vector param byte[] is error #57

zymgg opened this issue Jun 20, 2024 · 0 comments

Comments

@zymgg
Copy link

zymgg commented Jun 20, 2024

pom.xml

<dependency>
    <groupId>com.redis</groupId>
    <artifactId>spring-lettucemod</artifactId>
    <version>3.8.0</version>
</dependency>

Java Code

byte[] vector = floatArrayToByteArray(floats);
String queryString = "*=>KNN " + 20 + " @pictureFeatureVector $vector";
List<KeyValue<String, Object>> params = new ArrayList<>();
params.add(KeyValue.just("vector", vector));
SearchOptions<String, Object> searchOptions = new SearchOptions<>();
searchOptions.setParams(params);
searchOptions.setDialect(OptionalInt.of(2));
System.out.println(queryString);
System.out.println(result);
RedisModulesCommands<String, Object> commands = redisConnection.sync();
SearchResults<String, Object> searchResults = commands.ftSearch(GOODS_IMAGE_VECTORS_INDEX, queryString, searchOptions);
System.out.println(searchResults);

error info
Cannot encode command. Please close the connection as the connection state may be out of sync.
class [B cannot be cast to class java.lang.String ([B and java.lang.String are in module java.base of loader 'bootstrap')

why i cant transmit byte[] data?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant