Skip to content

Commit 959cf6b

Browse files
authored
FT.SEARCH, FT.AGGREGATE, etc commands are round robin mode by default (#3375)
with an option to choose RediSearch-Light mode for those commands
1 parent 6b5025f commit 959cf6b

7 files changed

+121
-190
lines changed

src/main/java/redis/clients/jedis/ClusterCommandObjects.java

Lines changed: 0 additions & 131 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,11 @@
44
import static redis.clients.jedis.Protocol.Command.SCAN;
55
import static redis.clients.jedis.Protocol.Keyword.TYPE;
66

7-
import java.util.List;
8-
import java.util.Map;
97
import java.util.Set;
108

119
import redis.clients.jedis.commands.ProtocolCommand;
1210
import redis.clients.jedis.params.ScanParams;
1311
import redis.clients.jedis.resps.ScanResult;
14-
import redis.clients.jedis.search.IndexOptions;
15-
import redis.clients.jedis.search.Query;
16-
import redis.clients.jedis.search.Schema;
17-
import redis.clients.jedis.search.SearchResult;
18-
import redis.clients.jedis.search.aggr.AggregationBuilder;
19-
import redis.clients.jedis.search.aggr.AggregationResult;
2012
import redis.clients.jedis.util.JedisClusterHashTag;
2113

2214
public class ClusterCommandObjects extends CommandObjects {
@@ -105,127 +97,4 @@ public final CommandObject<ScanResult<byte[]>> scan(byte[] cursor, ScanParams pa
10597
public final CommandObject<Long> waitReplicas(int replicas, long timeout) {
10698
throw new UnsupportedOperationException(CLUSTER_UNSUPPORTED_MESSAGE);
10799
}
108-
109-
// RediSearch commands
110-
// TODO: Send RediSearch command to random 'master' node or random hashslot.
111-
// boolean searchLite = false;
112-
113-
private <T> CommandObject<T> processSearchCommand(String indexName, CommandObject<T> command) {
114-
// if (searchLite) command.getArguments().processKey(indexName);
115-
command.getArguments().processKey(indexName);
116-
return command;
117-
}
118-
119-
@Override
120-
public final CommandObject<String> ftCreate(String indexName, IndexOptions indexOptions, Schema schema) {
121-
return processSearchCommand(indexName, super.ftCreate(indexName, indexOptions, schema));
122-
}
123-
124-
@Override
125-
public final CommandObject<String> ftAlter(String indexName, Schema schema) {
126-
return processSearchCommand(indexName, super.ftAlter(indexName, schema));
127-
}
128-
129-
@Override
130-
public final CommandObject<SearchResult> ftSearch(String indexName, Query query) {
131-
return processSearchCommand(indexName, super.ftSearch(indexName, query));
132-
}
133-
134-
@Override
135-
public final CommandObject<SearchResult> ftSearch(byte[] indexName, Query query) {
136-
CommandObject<SearchResult> command = super.ftSearch(indexName, query);
137-
// if (searchLite) command.getArguments().processKey(indexName);
138-
command.getArguments().processKey(indexName);
139-
return command;
140-
}
141-
142-
@Override
143-
public CommandObject<String> ftExplain(String indexName, Query query) {
144-
return processSearchCommand(indexName, super.ftExplain(indexName, query));
145-
}
146-
147-
@Override
148-
public CommandObject<List<String>> ftExplainCLI(String indexName, Query query) {
149-
return processSearchCommand(indexName, super.ftExplainCLI(indexName, query));
150-
}
151-
152-
@Override
153-
public CommandObject<AggregationResult> ftAggregate(String indexName, AggregationBuilder aggr) {
154-
return processSearchCommand(indexName, super.ftAggregate(indexName, aggr));
155-
}
156-
157-
@Override
158-
public CommandObject<AggregationResult> ftCursorRead(String indexName, long cursorId, int count) {
159-
return processSearchCommand(indexName, super.ftCursorRead(indexName, cursorId, count));
160-
}
161-
162-
@Override
163-
public CommandObject<String> ftCursorDel(String indexName, long cursorId) {
164-
return processSearchCommand(indexName, super.ftCursorDel(indexName, cursorId));
165-
}
166-
167-
@Override
168-
public CommandObject<String> ftDropIndex(String indexName) {
169-
return processSearchCommand(indexName, super.ftDropIndex(indexName));
170-
}
171-
172-
@Override
173-
public CommandObject<String> ftDropIndexDD(String indexName) {
174-
return processSearchCommand(indexName, super.ftDropIndexDD(indexName));
175-
}
176-
177-
@Override
178-
public CommandObject<String> ftSynUpdate(String indexName, String synonymGroupId, String... terms) {
179-
return processSearchCommand(indexName, super.ftSynUpdate(indexName, synonymGroupId, terms));
180-
}
181-
182-
@Override
183-
public CommandObject<Map<String, List<String>>> ftSynDump(String indexName) {
184-
return processSearchCommand(indexName, super.ftSynDump(indexName));
185-
}
186-
187-
@Override
188-
public CommandObject<Map<String, Object>> ftInfo(String indexName) {
189-
return processSearchCommand(indexName, super.ftInfo(indexName));
190-
}
191-
192-
@Override
193-
public CommandObject<Set<String>> ftTagVals(String indexName, String fieldName) {
194-
return processSearchCommand(indexName, super.ftTagVals(indexName, fieldName));
195-
}
196-
197-
@Override
198-
public CommandObject<String> ftAliasAdd(String aliasName, String indexName) {
199-
// CommandObject<String> command = super.ftAliasAdd(aliasName, indexName);
200-
// if (searchLite) command.getArguments().processKey(aliasName).processKey(indexName);
201-
// return command;
202-
return processSearchCommand(indexName, super.ftAliasAdd(aliasName, indexName));
203-
}
204-
205-
@Override
206-
public CommandObject<String> ftAliasUpdate(String aliasName, String indexName) {
207-
// CommandObject<String> command = super.ftAliasUpdate(aliasName, indexName);
208-
// if (searchLite) command.getArguments().processKey(aliasName).processKey(indexName);
209-
// return command;
210-
return processSearchCommand(indexName, super.ftAliasUpdate(aliasName, indexName));
211-
}
212-
213-
@Override
214-
public CommandObject<String> ftAliasDel(String aliasName) {
215-
// CommandObject<String> command = super.ftAliasDel(aliasName);
216-
// if (searchLite) command.getArguments().processKey(aliasName);
217-
// return command;
218-
return processSearchCommand(aliasName, super.ftAliasDel(aliasName));
219-
}
220-
221-
@Override
222-
public CommandObject<Map<String, String>> ftConfigGet(String indexName, String option) {
223-
return processSearchCommand(indexName, super.ftConfigGet(indexName, option));
224-
}
225-
226-
@Override
227-
public CommandObject<String> ftConfigSet(String indexName, String option, String value) {
228-
return processSearchCommand(indexName, super.ftConfigSet(indexName, option, value));
229-
}
230-
// RediSearch commands
231100
}

0 commit comments

Comments
 (0)