-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'redis:main' into topic/kiryazovi-redis/use-docker-for-t…
…ests
- Loading branch information
Showing
44 changed files
with
2,733 additions
and
161 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
63 changes: 63 additions & 0 deletions
63
src/main/java/io/lettuce/core/RediSearchCommandBuilder.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* | ||
* Copyright 2025, Redis Ltd. and Contributors | ||
* All rights reserved. | ||
* | ||
* Licensed under the MIT License. | ||
*/ | ||
package io.lettuce.core; | ||
|
||
import io.lettuce.core.codec.RedisCodec; | ||
import io.lettuce.core.output.StatusOutput; | ||
import io.lettuce.core.protocol.BaseRedisCommandBuilder; | ||
import io.lettuce.core.protocol.Command; | ||
import io.lettuce.core.protocol.CommandArgs; | ||
import io.lettuce.core.protocol.CommandKeyword; | ||
import io.lettuce.core.search.arguments.CreateArgs; | ||
import io.lettuce.core.search.Field; | ||
|
||
import java.util.List; | ||
|
||
import static io.lettuce.core.protocol.CommandType.*; | ||
|
||
/** | ||
* Command builder for RediSearch commands. | ||
* | ||
* @param <K> Key type. | ||
* @param <V> Value type. | ||
* @since 6.6 | ||
*/ | ||
class RediSearchCommandBuilder<K, V> extends BaseRedisCommandBuilder<K, V> { | ||
|
||
RediSearchCommandBuilder(RedisCodec<K, V> codec) { | ||
super(codec); | ||
} | ||
|
||
/** | ||
* Create a new index with the given name, index options and fields. | ||
* | ||
* @param index the index name | ||
* @param createArgs the index options | ||
* @param fields the fields | ||
* @return the result of the create command | ||
*/ | ||
public Command<K, V, String> ftCreate(K index, CreateArgs<K, V> createArgs, List<Field<K>> fields) { | ||
notNullKey(index); | ||
notEmpty(fields.toArray()); | ||
|
||
CommandArgs<K, V> args = new CommandArgs<>(codec).addKey(index); | ||
|
||
if (createArgs != null) { | ||
createArgs.build(args); | ||
} | ||
|
||
args.add(CommandKeyword.SCHEMA); | ||
|
||
for (Field<K> field : fields) { | ||
field.build(args); | ||
} | ||
|
||
return createCommand(FT_CREATE, new StatusOutput<>(codec), args); | ||
|
||
} | ||
|
||
} |
Oops, something went wrong.