
com.redislabs.lettusearch.index.field.FieldOptions Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lettusearch Show documentation
Show all versions of lettusearch Show documentation
Java client for RediSearch based on Lettuce
package com.redislabs.lettusearch.index.field;
import static com.redislabs.lettusearch.protocol.CommandKeyword.NOINDEX;
import static com.redislabs.lettusearch.protocol.CommandKeyword.NOSTEM;
import static com.redislabs.lettusearch.protocol.CommandKeyword.PHONETIC;
import static com.redislabs.lettusearch.protocol.CommandKeyword.SEPARATOR;
import static com.redislabs.lettusearch.protocol.CommandKeyword.SORTABLE;
import static com.redislabs.lettusearch.protocol.CommandKeyword.WEIGHT;
import com.redislabs.lettusearch.RediSearchArgument;
import com.redislabs.lettusearch.protocol.RediSearchCommandArgs;
import lombok.Builder;
import lombok.Builder.Default;
import lombok.Data;
@Data
@Builder
public class FieldOptions implements RediSearchArgument {
@Default
private FieldType type = FieldType.Text;
private boolean sortable;
private boolean noIndex;
private Double weight;
private boolean noStem;
private PhoneticMatcher matcher;
private String separator;
@Override
public void build(RediSearchCommandArgs args) {
args.add(type.getKeyword());
if (noStem) {
args.add(NOSTEM);
}
if (weight != null) {
args.add(WEIGHT);
args.add(weight);
}
if (matcher != null) {
args.add(PHONETIC);
args.add(matcher.getCode());
}
if (separator != null) {
args.add(SEPARATOR);
args.add(separator);
}
if (sortable) {
args.add(SORTABLE);
}
if (noIndex) {
args.add(NOINDEX);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy