-
Notifications
You must be signed in to change notification settings - Fork 59
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug A clear and concise description of what the bug is.
Currently, the "CONTAIN" filter condition is not supported in Search, because the getQueryBuilderFromCriterion
in SearchUtils
class explicitly does not support it.
final Condition condition = criterion.getCondition();
if (condition == Condition.EQUAL) {
if (criterion.getValue().startsWith("urn:li:")) {
return QueryBuilders.termsQuery(criterion.getField(), criterion.getValue().trim());
}
return QueryBuilders.termsQuery(criterion.getField(), criterion.getValue().trim().split("\\s*,\\s*"));
} else if (condition == Condition.GREATER_THAN) {
return QueryBuilders.rangeQuery(criterion.getField()).gt(criterion.getValue().trim());
} else if (condition == Condition.GREATER_THAN_OR_EQUAL_TO) {
return QueryBuilders.rangeQuery(criterion.getField()).gte(criterion.getValue().trim());
} else if (condition == Condition.LESS_THAN) {
return QueryBuilders.rangeQuery(criterion.getField()).lt(criterion.getValue().trim());
} else if (condition == Condition.LESS_THAN_OR_EQUAL_TO) {
return QueryBuilders.rangeQuery(criterion.getField()).lte(criterion.getValue().trim());
}
throw new UnsupportedOperationException("Unsupported condition: " + condition);
}```
(even though it exists in the Filter Condition enum.
#### To Reproduce
Steps to reproduce the behavior:
1. Deploy DataHub
2. Issue a Search Query with a specific "filter" criteria that has the condition "CONTAIN". You'll see a server error returned.

#### Expected behavior
Contains operator should work for substring of string fields.
As reported by Lal Rishav at Saxo Bank!
#### Screenshots If applicable, add screenshots to help explain your problem.
#### Desktop (please complete the following information):
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]
#### Additional context
Add any other context about the problem here.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working