use of datawave.query.search.WildcardFieldedFilter in project datawave by NationalSecurityAgency.
the class AbstractEvaluationPhaseFunction method initialize.
@Override
public void initialize(List<String> parameterList, int depth, QueryNode parent) throws IllegalArgumentException {
// super initialize will call validate
super.initialize(parameterList, depth, parent);
WildcardFieldedFilter.BooleanType type = WildcardFieldedFilter.BooleanType.AND;
int x = 0;
if (this.parameterList.size() != 1 && this.parameterList.size() % 2 == 1) {
try {
String firstArg = this.parameterList.get(0);
type = WildcardFieldedFilter.BooleanType.valueOf(firstArg.toUpperCase());
} catch (Exception e) {
BadRequestQueryException qe = new BadRequestQueryException(DatawaveErrorCode.INVALID_FUNCTION_ARGUMENTS, MessageFormat.format("{0}", e, this.name));
throw new IllegalArgumentException(qe);
}
x = 1;
}
this.fieldedFilter = new WildcardFieldedFilter(includeIfMatch, type);
// special case where one argument will be matched against any field
if (this.parameterList.size() == 1) {
this.fieldedFilter.addCondition(Constants.ANY_FIELD, parameterList.get(0));
} else {
while (x < parameterList.size()) {
String field = parameterList.get(x++);
String regex = parameterList.get(x++);
this.fieldedFilter.addCondition(field, regex);
}
}
}
use of datawave.query.search.WildcardFieldedFilter in project datawave by NationalSecurityAgency.
the class GetAllMatches method initialize.
@Override
public void initialize(List<String> parameterList, int depth, QueryNode parent) throws IllegalArgumentException {
super.initialize(parameterList, depth, parent);
WildcardFieldedFilter.BooleanType type = WildcardFieldedFilter.BooleanType.AND;
int x = 0;
if (this.parameterList.size() % 2 == 1) {
try {
String firstArg = this.parameterList.get(0);
type = WildcardFieldedFilter.BooleanType.valueOf(firstArg.toUpperCase());
} catch (Exception e) {
BadRequestQueryException qe = new BadRequestQueryException(DatawaveErrorCode.INVALID_FUNCTION_ARGUMENTS, MessageFormat.format("{0}", e, this.name));
throw new IllegalArgumentException(qe);
}
x = 1;
}
this.fieldedFilter = new WildcardFieldedFilter(true, type);
while (x < parameterList.size()) {
String field = parameterList.get(x++);
String regex = parameterList.get(x++);
this.fieldedFilter.addCondition(field, regex);
}
}
use of datawave.query.search.WildcardFieldedFilter in project datawave by NationalSecurityAgency.
the class IsNotNull method initialize.
@Override
public void initialize(List<String> parameterList, int depth, QueryNode parent) throws IllegalArgumentException {
super.initialize(parameterList, depth, parent);
// the dot (.) does not match line terminator characters, so we must specify them here
this.fieldedFilter = new WildcardFieldedFilter(true, WildcardFieldedFilter.BooleanType.AND);
this.fieldedFilter.addCondition(parameterList.get(0), ".+");
}
use of datawave.query.search.WildcardFieldedFilter in project datawave by NationalSecurityAgency.
the class IsNull method initialize.
@Override
public void initialize(List<String> parameterList, int depth, QueryNode parent) throws IllegalArgumentException {
super.initialize(parameterList, depth, parent);
this.fieldedFilter = new WildcardFieldedFilter(false, WildcardFieldedFilter.BooleanType.AND);
this.fieldedFilter.addCondition(parameterList.get(0), ".+");
}
use of datawave.query.search.WildcardFieldedFilter in project datawave by NationalSecurityAgency.
the class Occurrence method initialize.
@Override
public void initialize(List<String> parameterList, int depth, QueryNode parent) throws IllegalArgumentException {
super.initialize(parameterList, depth, parent);
WildcardFieldedFilter.BooleanType type = WildcardFieldedFilter.BooleanType.AND;
int x = 0;
if (this.parameterList.size() % 2 == 1) {
try {
String firstArg = this.parameterList.get(0);
type = WildcardFieldedFilter.BooleanType.valueOf(firstArg.toUpperCase());
} catch (Exception e) {
BadRequestQueryException qe = new BadRequestQueryException(DatawaveErrorCode.INVALID_FUNCTION_ARGUMENTS, MessageFormat.format("{0}", e, this.name));
throw new IllegalArgumentException(qe);
}
x = 1;
}
this.fieldedFilter = new WildcardFieldedFilter(true, type);
while (x < parameterList.size()) {
String field = parameterList.get(x++);
String regex = parameterList.get(x++);
this.fieldedFilter.addCondition(field, regex);
}
}
Aggregations