Fixed - STOPWORDS 0 can't be defined during RSearch index creation.

pull/6396/head
Nikita Koksharov 2 weeks ago
parent 7ea88fbce2
commit d31be67220

@ -123,10 +123,14 @@ public class RedissonSearch implements RSearch {
if (options.isNoFreqs()) { if (options.isNoFreqs()) {
args.add("NOFREQS"); args.add("NOFREQS");
} }
if (!options.getStopwords().isEmpty()) { if (options.getStopwords() != null) {
args.add("STOPWORDS"); args.add("STOPWORDS");
args.add(options.getStopwords().size()); if (options.getStopwords().isEmpty()) {
args.addAll(options.getStopwords()); args.add(0);
} else {
args.add(options.getStopwords().size());
args.addAll(options.getStopwords());
}
} }
if (options.isSkipInitialScan()) { if (options.isSkipInitialScan()) {
args.add("SKIPINITIALSCAN"); args.add("SKIPINITIALSCAN");

@ -39,7 +39,7 @@ public final class IndexOptions {
private String scoreField; private String scoreField;
private boolean noHL; private boolean noHL;
private boolean noFreqs; private boolean noFreqs;
private List<String> stopwords = Collections.emptyList(); private List<String> stopwords;
private boolean skipInitialScan; private boolean skipInitialScan;
private IndexType on; private IndexType on;
private byte[] payloadField; private byte[] payloadField;

@ -61,6 +61,7 @@ public class RedissonSearchTest extends DockerRedisStackTest {
RSearch s = redisson.getSearch(); RSearch s = redisson.getSearch();
s.createIndex("idx", IndexOptions.defaults() s.createIndex("idx", IndexOptions.defaults()
.on(IndexType.HASH) .on(IndexType.HASH)
.stopwords(Collections.emptyList())
.prefix(Arrays.asList("doc:")), .prefix(Arrays.asList("doc:")),
FieldIndex.text("t1"), FieldIndex.text("t1"),
FieldIndex.text("t2")); FieldIndex.text("t2"));

Loading…
Cancel
Save