Skip to content

Commit

Permalink
Re-add FT.DROPINDEX and FT.ALTER in pipeline (#3549)
Browse files Browse the repository at this point in the history
Re-add FT.DROPINDEX and FT.ALTER commands in pipeline interface for Ephermal search feature
  • Loading branch information
sazzad16 authored Sep 21, 2023
1 parent 6a3ca3b commit af92035
Show file tree
Hide file tree
Showing 6 changed files with 116 additions and 56 deletions.
42 changes: 21 additions & 21 deletions src/main/java/redis/clients/jedis/CommandObjects.java
Original file line number Diff line number Diff line change
Expand Up @@ -3193,6 +3193,27 @@ public final CommandObject<String> ftAlter(String indexName, Iterable<SchemaFiel
return new CommandObject<>(args, BuilderFactory.STRING);
}

public final CommandObject<String> ftAliasAdd(String aliasName, String indexName) {
return new CommandObject<>(commandArguments(SearchCommand.ALIASADD).add(aliasName).add(indexName), BuilderFactory.STRING);
}

public final CommandObject<String> ftAliasUpdate(String aliasName, String indexName) {
return new CommandObject<>(commandArguments(SearchCommand.ALIASUPDATE).add(aliasName).add(indexName), BuilderFactory.STRING);
}

public final CommandObject<String> ftAliasDel(String aliasName) {
return new CommandObject<>(commandArguments(SearchCommand.ALIASDEL).add(aliasName), BuilderFactory.STRING);
}

public final CommandObject<String> ftDropIndex(String indexName) {
return new CommandObject<>(commandArguments(SearchCommand.DROPINDEX).add(indexName), BuilderFactory.STRING);
}

public final CommandObject<String> ftDropIndexDD(String indexName) {
return new CommandObject<>(commandArguments(SearchCommand.DROPINDEX).add(indexName).add(SearchKeyword.DD),
BuilderFactory.STRING);
}

public final CommandObject<SearchResult> ftSearch(String indexName, String query) {
return new CommandObject<>(checkAndRoundRobinSearchCommand(commandArguments(SearchCommand.SEARCH), indexName).add(query),
getSearchResultBuilder(() -> new SearchResultBuilder(true, false, true)));
Expand Down Expand Up @@ -3277,15 +3298,6 @@ private Builder<SearchResult> getSearchResultBuilder(Supplier<Builder<SearchResu
return resp2.get();
}

public final CommandObject<String> ftDropIndex(String indexName) {
return new CommandObject<>(commandArguments(SearchCommand.DROPINDEX).add(indexName), BuilderFactory.STRING);
}

public final CommandObject<String> ftDropIndexDD(String indexName) {
return new CommandObject<>(commandArguments(SearchCommand.DROPINDEX).add(indexName).add(SearchKeyword.DD),
BuilderFactory.STRING);
}

public final CommandObject<String> ftSynUpdate(String indexName, String synonymGroupId, String... terms) {
return new CommandObject<>(checkAndRoundRobinSearchCommand(commandArguments(SearchCommand.SYNUPDATE), indexName)
.add(synonymGroupId).addObjects((Object[]) terms), BuilderFactory.STRING);
Expand Down Expand Up @@ -3343,18 +3355,6 @@ public final CommandObject<Set<String>> ftTagVals(String indexName, String field
.add(fieldName), BuilderFactory.STRING_SET);
}

public final CommandObject<String> ftAliasAdd(String aliasName, String indexName) {
return new CommandObject<>(commandArguments(SearchCommand.ALIASADD).add(aliasName).add(indexName), BuilderFactory.STRING);
}

public final CommandObject<String> ftAliasUpdate(String aliasName, String indexName) {
return new CommandObject<>(commandArguments(SearchCommand.ALIASUPDATE).add(aliasName).add(indexName), BuilderFactory.STRING);
}

public final CommandObject<String> ftAliasDel(String aliasName) {
return new CommandObject<>(commandArguments(SearchCommand.ALIASDEL).add(aliasName), BuilderFactory.STRING);
}

public final CommandObject<Map<String, Object>> ftConfigGet(String option) {
return new CommandObject<>(commandArguments(SearchCommand.CONFIG).add(SearchKeyword.GET).add(option),
protocol == RedisProtocol.RESP3 ? BuilderFactory.AGGRESSIVE_ENCODED_OBJECT_MAP : BuilderFactory.ENCODED_OBJECT_MAP_FROM_PAIRS);
Expand Down
25 changes: 25 additions & 0 deletions src/main/java/redis/clients/jedis/PipelineBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -3283,6 +3283,31 @@ public Response<String> ftAlter(String indexName, Iterable<SchemaField> schemaFi
return appendCommand(commandObjects.ftAlter(indexName, schemaFields));
}

@Override
public Response<String> ftAliasAdd(String aliasName, String indexName) {
return appendCommand(commandObjects.ftAliasAdd(aliasName, indexName));
}

@Override
public Response<String> ftAliasUpdate(String aliasName, String indexName) {
return appendCommand(commandObjects.ftAliasUpdate(aliasName, indexName));
}

@Override
public Response<String> ftAliasDel(String aliasName) {
return appendCommand(commandObjects.ftAliasDel(aliasName));
}

@Override
public Response<String> ftDropIndex(String indexName) {
return appendCommand(commandObjects.ftDropIndex(indexName));
}

@Override
public Response<String> ftDropIndexDD(String indexName) {
return appendCommand(commandObjects.ftDropIndexDD(indexName));
}

@Override
public Response<SearchResult> ftSearch(String indexName, String query) {
return appendCommand(commandObjects.ftSearch(indexName, query));
Expand Down
25 changes: 25 additions & 0 deletions src/main/java/redis/clients/jedis/TransactionBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -3450,6 +3450,31 @@ public Response<String> ftAlter(String indexName, Iterable<SchemaField> schemaFi
return appendCommand(commandObjects.ftAlter(indexName, schemaFields));
}

@Override
public Response<String> ftAliasAdd(String aliasName, String indexName) {
return appendCommand(commandObjects.ftAliasAdd(aliasName, indexName));
}

@Override
public Response<String> ftAliasUpdate(String aliasName, String indexName) {
return appendCommand(commandObjects.ftAliasUpdate(aliasName, indexName));
}

@Override
public Response<String> ftAliasDel(String aliasName) {
return appendCommand(commandObjects.ftAliasDel(aliasName));
}

@Override
public Response<String> ftDropIndex(String indexName) {
return appendCommand(commandObjects.ftDropIndex(indexName));
}

@Override
public Response<String> ftDropIndexDD(String indexName) {
return appendCommand(commandObjects.ftDropIndexDD(indexName));
}

@Override
public Response<SearchResult> ftSearch(String indexName, String query) {
return appendCommand(commandObjects.ftSearch(indexName, query));
Expand Down
50 changes: 25 additions & 25 deletions src/main/java/redis/clients/jedis/UnifiedJedis.java
Original file line number Diff line number Diff line change
Expand Up @@ -3636,6 +3636,31 @@ public String ftAlter(String indexName, Iterable<SchemaField> schemaFields) {
return checkAndBroadcastCommand(commandObjects.ftAlter(indexName, schemaFields));
}

@Override
public String ftAliasAdd(String aliasName, String indexName) {
return checkAndBroadcastCommand(commandObjects.ftAliasAdd(aliasName, indexName));
}

@Override
public String ftAliasUpdate(String aliasName, String indexName) {
return checkAndBroadcastCommand(commandObjects.ftAliasUpdate(aliasName, indexName));
}

@Override
public String ftAliasDel(String aliasName) {
return checkAndBroadcastCommand(commandObjects.ftAliasDel(aliasName));
}

@Override
public String ftDropIndex(String indexName) {
return checkAndBroadcastCommand(commandObjects.ftDropIndex(indexName));
}

@Override
public String ftDropIndexDD(String indexName) {
return checkAndBroadcastCommand(commandObjects.ftDropIndexDD(indexName));
}

@Override
public SearchResult ftSearch(String indexName, String query) {
return executeCommand(commandObjects.ftSearch(indexName, query));
Expand Down Expand Up @@ -3733,16 +3758,6 @@ public Map.Entry<SearchResult, Map<String, Object>> ftProfileSearch(String index
return executeCommand(commandObjects.ftProfileSearch(indexName, profileParams, query, searchParams));
}

@Override
public String ftDropIndex(String indexName) {
return checkAndBroadcastCommand(commandObjects.ftDropIndex(indexName));
}

@Override
public String ftDropIndexDD(String indexName) {
return checkAndBroadcastCommand(commandObjects.ftDropIndexDD(indexName));
}

@Override
public String ftSynUpdate(String indexName, String synonymGroupId, String... terms) {
return executeCommand(commandObjects.ftSynUpdate(indexName, synonymGroupId, terms));
Expand Down Expand Up @@ -3803,21 +3818,6 @@ public Set<String> ftTagVals(String indexName, String fieldName) {
return executeCommand(commandObjects.ftTagVals(indexName, fieldName));
}

@Override
public String ftAliasAdd(String aliasName, String indexName) {
return checkAndBroadcastCommand(commandObjects.ftAliasAdd(aliasName, indexName));
}

@Override
public String ftAliasUpdate(String aliasName, String indexName) {
return checkAndBroadcastCommand(commandObjects.ftAliasUpdate(aliasName, indexName));
}

@Override
public String ftAliasDel(String aliasName) {
return checkAndBroadcastCommand(commandObjects.ftAliasDel(aliasName));
}

@Override
public Map<String, Object> ftConfigGet(String option) {
return executeCommand(commandObjects.ftConfigGet(option));
Expand Down
20 changes: 10 additions & 10 deletions src/main/java/redis/clients/jedis/search/RediSearchCommands.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,16 @@ default String ftAlter(String indexName, SchemaField... schemaFields) {

String ftAlter(String indexName, Iterable<SchemaField> schemaFields);

String ftAliasAdd(String aliasName, String indexName);

String ftAliasUpdate(String aliasName, String indexName);

String ftAliasDel(String aliasName);

String ftDropIndex(String indexName);

String ftDropIndexDD(String indexName);

default SearchResult ftSearch(String indexName) {
return ftSearch(indexName, "*");
}
Expand Down Expand Up @@ -72,10 +82,6 @@ Map.Entry<SearchResult, Map<String, Object>> ftProfileSearch(String indexName,
Map.Entry<SearchResult, Map<String, Object>> ftProfileSearch(String indexName,
FTProfileParams profileParams, String query, FTSearchParams searchParams);

String ftDropIndex(String indexName);

String ftDropIndexDD(String indexName);

String ftSynUpdate(String indexName, String synonymGroupId, String... terms);

Map<String, List<String>> ftSynDump(String indexName);
Expand All @@ -101,12 +107,6 @@ Map<String, Map<String, Double>> ftSpellCheck(String index, String query,

Set<String> ftTagVals(String indexName, String fieldName);

String ftAliasAdd(String aliasName, String indexName);

String ftAliasUpdate(String aliasName, String indexName);

String ftAliasDel(String aliasName);

Map<String, Object> ftConfigGet(String option);

Map<String, Object> ftConfigGet(String indexName, String option);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,16 @@ default Response<String> ftAlter(String indexName, SchemaField... schemaFields)

Response<String> ftAlter(String indexName, Iterable<SchemaField> schemaFields);

Response<String> ftAliasAdd(String aliasName, String indexName);

Response<String> ftAliasUpdate(String aliasName, String indexName);

Response<String> ftAliasDel(String aliasName);

Response<String> ftDropIndex(String indexName);

Response<String> ftDropIndexDD(String indexName);

default Response<SearchResult> ftSearch(String indexName) {
return ftSearch(indexName, "*");
}
Expand Down

0 comments on commit af92035

Please sign in to comment.