Commit c0f0abc1 by apoorvnaik Committed by Madhan Neethiraj

ATLAS-2121: basic-search update to use case-sensitive filter for type-name / tag-name

parent 400477c4
......@@ -34,6 +34,7 @@ import org.apache.atlas.util.SearchPredicateUtil;
import org.apache.atlas.utils.AtlasPerfTracer;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.Predicate;
import org.apache.commons.collections.PredicateUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -93,7 +94,14 @@ public class ClassificationSearchProcessor extends SearchProcessor {
this.indexQuery = graph.indexQuery(Constants.VERTEX_INDEX, indexQueryString);
inMemoryPredicate = constructInMemoryPredicate(classificationType, filterCriteria, indexAttributes);
Predicate typeNamePredicate = SearchPredicateUtil.getINPredicateGenerator()
.generatePredicate(Constants.TYPE_NAME_PROPERTY_KEY, typeAndSubTypes, String.class);
Predicate attributePredicate = constructInMemoryPredicate(classificationType, filterCriteria, indexAttributes);
if (attributePredicate != null) {
inMemoryPredicate = PredicateUtils.andPredicate(typeNamePredicate, attributePredicate);
} else {
inMemoryPredicate = typeNamePredicate;
}
} else {
indexQuery = null;
}
......
......@@ -80,12 +80,20 @@ public class EntitySearchProcessor extends SearchProcessor {
if (typeSearchByIndex) {
constructTypeTestQuery(indexQuery, typeAndSubTypesQryStr);
// TypeName check to be done in-memory as well to address ATLAS-2121 (case sensitivity)
inMemoryPredicate = typeNamePredicate;
}
if (attrSearchByIndex) {
constructFilterQuery(indexQuery, entityType, filterCriteria, indexAttributes);
inMemoryPredicate = constructInMemoryPredicate(entityType, filterCriteria, indexAttributes);
Predicate attributePredicate = constructInMemoryPredicate(entityType, filterCriteria, indexAttributes);
if (inMemoryPredicate != null) {
inMemoryPredicate = PredicateUtils.andPredicate(inMemoryPredicate, attributePredicate);
} else {
inMemoryPredicate = attributePredicate;
}
} else {
graphAttributes.addAll(indexAttributes);
}
......@@ -110,13 +118,6 @@ public class EntitySearchProcessor extends SearchProcessor {
if (!typeSearchByIndex) {
query.in(Constants.TYPE_NAME_PROPERTY_KEY, typeAndSubTypes);
// Construct a parallel in-memory predicate
if (graphQueryPredicate != null) {
graphQueryPredicate = PredicateUtils.andPredicate(graphQueryPredicate, typeNamePredicate);
} else {
graphQueryPredicate = typeNamePredicate;
}
}
// If we need to filter on the trait names then we need to build the query and equivalent in-memory predicate
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment