Skip to content

Commit

Permalink
Ignore full restrictions for Persona/Purpose request
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhilbonte21 committed Feb 21, 2024
1 parent f67e171 commit 031b00c
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1000,14 +1000,14 @@ public AtlasSearchResult directIndexSearch(SearchParams searchParams) throws Atl
String indexName = getIndexName(params);

indexQuery = graph.elasticsearchQuery(indexName);
if (searchParams.getEnableFullRestriction() && !VERTEX_INDEX_NAME.equals(indexName)) {
if (searchParams.getEnableFullRestriction() && VERTEX_INDEX_NAME.equals(indexName)) {
addPreFiltersToSearchQuery(searchParams);
}
//LOG.info(searchParams.getQuery());
AtlasPerfMetrics.MetricRecorder elasticSearchQueryMetric = RequestContext.get().startMetricRecord("elasticSearchQuery");
DirectIndexQueryResult indexQueryResult = indexQuery.vertices(searchParams);
RequestContext.get().endMetricRecord(elasticSearchQueryMetric);
prepareSearchResult(ret, indexQueryResult, resultAttributes, true);
prepareSearchResult(ret, indexQueryResult, resultAttributes, true, indexName);

ret.setAggregations(indexQueryResult.getAggregationMap());
ret.setApproximateCount(indexQuery.vertexTotals());
Expand Down Expand Up @@ -1044,7 +1044,8 @@ public SearchLogSearchResult searchLogs(SearchLogSearchParams searchParams) thro
}
}

private void prepareSearchResult(AtlasSearchResult ret, DirectIndexQueryResult indexQueryResult, Set<String> resultAttributes, boolean fetchCollapsedResults) throws AtlasBaseException {
private void prepareSearchResult(AtlasSearchResult ret, DirectIndexQueryResult indexQueryResult, Set<String> resultAttributes,
boolean fetchCollapsedResults, String indexName) throws AtlasBaseException {
SearchParams searchParams = ret.getSearchParameters();
try {
if(LOG.isDebugEnabled()){
Expand Down Expand Up @@ -1091,7 +1092,7 @@ private void prepareSearchResult(AtlasSearchResult ret, DirectIndexQueryResult i

DirectIndexQueryResult indexQueryCollapsedResult = result.getCollapseVertices(collapseKey);
collapseRet.setApproximateCount(indexQueryCollapsedResult.getApproximateCount());
prepareSearchResult(collapseRet, indexQueryCollapsedResult, collapseResultAttributes, false);
prepareSearchResult(collapseRet, indexQueryCollapsedResult, collapseResultAttributes, false, indexName);

collapseRet.setSearchParameters(null);
collapse.put(collapseKey, collapseRet);
Expand All @@ -1111,7 +1112,7 @@ private void prepareSearchResult(AtlasSearchResult ret, DirectIndexQueryResult i
throw e;
}

if (!searchParams.getEnableFullRestriction()) {
if (!searchParams.getEnableFullRestriction() || !VERTEX_INDEX_NAME.equals(indexName)) {
scrubSearchResults(ret, searchParams.getSuppressLogs());
}
}
Expand Down

0 comments on commit 031b00c

Please sign in to comment.