-
Notifications
You must be signed in to change notification settings - Fork 901
ATLAS-5032: Fix basic search when querying by long attribute values #356
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -112,6 +112,7 @@ public abstract class SearchProcessor { | |
| public static final int MAX_RESULT_SIZE = getApplicationProperty(Constants.INDEX_SEARCH_MAX_RESULT_SET_SIZE, 150); | ||
| public static final int MAX_QUERY_STR_LENGTH_TYPES = getApplicationProperty(Constants.INDEX_SEARCH_TYPES_MAX_QUERY_STR_LENGTH, 512); | ||
| public static final int MAX_QUERY_STR_LENGTH_TAGS = getApplicationProperty(Constants.INDEX_SEARCH_TAGS_MAX_QUERY_STR_LENGTH, 512); | ||
| public static final int SOLR_MAX_TOKEN_STR_LENGTH = getApplicationProperty(Constants.INDEX_SEARCH_SOLR_MAX_TOKEN_LENGTH, 255); | ||
| public static final String INDEX_SEARCH_PREFIX = AtlasGraphUtilsV2.getIndexSearchPrefix(); | ||
| public static final String AND_STR = " AND "; | ||
| public static final String EMPTY_STRING = ""; | ||
|
|
@@ -671,6 +672,10 @@ protected AtlasGraphQuery toGraphFilterQuery(Set<? extends AtlasStructType> stru | |
|
|
||
| for (AtlasStructType structType : structTypes) { | ||
| String qualifiedName = structType.getVertexPropertyName(criteria.getAttributeName()); | ||
| if (isIndexSearchable(criteria, structType)) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This fix was tested for how many hive_columns as for a hive_table for multiple hive_tables with this huge qualifiedname and name using basic search ? |
||
| LOG.debug("toGraphFilterQuery() ==> skipped attribute: {}, filter value: {}, and operator: {}", criteria.getAttributeName(), criteria.getAttributeValue(), criteria.getOperator()); | ||
| continue; | ||
| } | ||
|
|
||
| if (filterAttributes.contains(qualifiedName)) { | ||
| String attrName = criteria.getAttributeName(); | ||
|
|
@@ -866,6 +871,10 @@ private boolean isIndexSearchable(FilterCriteria filterCriteria, AtlasStructType | |
| } else if (operator == SearchParameters.Operator.CONTAINS && AtlasAttribute.hastokenizeChar(attributeValue) && indexType == null) { // indexType = TEXT | ||
| LOG.debug("{} operator found for string (TEXT) attribute {} and special characters found in filter value {}, deferring to in-memory or graph query (might cause poor performance)", operator, qualifiedName, attributeValue); | ||
|
|
||
| ret = false; | ||
| } else if ((operator == SearchParameters.Operator.STARTS_WITH || operator == SearchParameters.Operator.ENDS_WITH || operator == SearchParameters.Operator.CONTAINS) && attributeValue.length() > SOLR_MAX_TOKEN_STR_LENGTH) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bypasses index for these operators when value length exceeds the limit. Falls back to a graph traversal! |
||
| LOG.debug("{} operator found for string attribute {} (SOLR MAX TOKEN STR LENGTH:{}) and filter value {}, deferring to in-memory or graph query (might cause poor performance)", operator, qualifiedName, SOLR_MAX_TOKEN_STR_LENGTH, attributeValue); | ||
|
|
||
| ret = false; | ||
| } | ||
| } | ||
|
|
@@ -920,6 +929,10 @@ private String toIndexQuery(Set<? extends AtlasStructType> structTypes, FilterCr | |
| ArrayList<String> orExpQuery = new ArrayList<>(); | ||
|
|
||
| for (AtlasStructType structType : structTypes) { | ||
| if (!isIndexSearchable(criteria, structType)) { | ||
| LOG.debug("toIndexQuery() ==> skipped attribute: {}, and filter value: {}, and operator: {}", criteria.getAttributeName(), criteria.getAttributeValue(), criteria.getOperator()); | ||
| continue; | ||
| } | ||
| String name = structType.getVertexPropertyName(criteria.getAttributeName()); | ||
|
|
||
| if (filterAttributes.contains(name)) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adds a new configurable constant tied to Solr’s default maxTokenLen (255).
Useful for operators (STARTS_WITH, ENDS_WITH, CONTAINS) that can’t safely be processed via the index when values exceed the token length.
Why this helps: avoids Solr truncation and allows search to fall back to the graph safely on long values.