fix(metadata-io):Recently viewed, Recently Edited and Recently Searched section is missing in datahub home page #10234
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue:
We currently observe that the Recently Viewed and Recently Edited section is missing on datahub home page.
Also, Recently Searches section is missing on search bar
Root cause:
When the
SearchRequest
for Recently Viewed/Edited or Searched item is build then instead of considering theSession User
,System User
is used in theSearchRequest
asactorUrn
.Example
SearchRequest
of Recently Viewed from my local debug log:SearchRequest{searchType=QUERY_THEN_FETCH, indices=[datahub_usage_event], indicesOptions=IndicesOptions[ignore_unavailable=false, allow_no_indices=true, expand_wildcards_open=true, expand_wildcards_closed=false, expand_wildcards_hidden=false, allow_aliases_to_multiple_indices=true, forbid_closed_indices=true, ignore_aliases=false, ignore_throttled=true], routing='null', preference='null', requestCache=null, scroll=null, maxConcurrentShardRequests=0, batchedReduceSize=512, preFilterShardSize=null, allowPartialSearchResults=null, localClusterAlias=null, getOrCreateAbsoluteStartMillis=-1, ccsMinimizeRoundtrips=true, source={"size":0,"query":{"bool":{"must":[{"term":{"actorUrn.keyword":{"value":"urn:li:corpuser:__datahub_system","boost":1.0}}},{"term":{"type":{"value":"EntityViewEvent","boost":1.0}}}],"adjust_pure_negative":true,"boost":1.0}},"aggregations":{"entity":{"terms":{"field":"entityUrn.keyword","size":5,"min_doc_count":1,"shard_min_doc_count":0,"show_term_doc_count_error":false,"order":[{"last_viewed":"desc"},{"_key":"asc"}]},"aggregations":{"last_viewed":{"max":{"field":"timestamp"}}}}}}, cancelAfterTimeInterval=null, pipeline=null}
Response:
{"took":12,"timed_out":false,"_shards":{"total":1,"successful":1,"skipped":0,"failed":0},"hits":{"total":{"value":0,"relation":"eq"},"max_score":null,"hits":[]},"aggregations":{"sterms#entity":{"doc_count_error_upper_bound":0,"sum_other_doc_count":0,"buckets":[]}}}
If you observe the
SearchRequest
above, instead of using the Session User(urn:li:corpuser:[email protected]
) it is building theSearchRequest
with the System User:urn:li:corpuser:__datahub_system
.That's why the response of this
SearchRequest
does not contain any data.Fix:
Use the user from the getSessionActorContext() while building the
SearchRequest
for Recently Viewed, Edited and Searched items.Test result:
![Screenshot 2024-04-09 at 12 00 31](https://private-user-images.githubusercontent.com/68184387/320808087-fec21a51-2c70-4274-b6dc-586267f24dae.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjM3ODQzNjksIm5iZiI6MTcyMzc4NDA2OSwicGF0aCI6Ii82ODE4NDM4Ny8zMjA4MDgwODctZmVjMjFhNTEtMmM3MC00Mjc0LWI2ZGMtNTg2MjY3ZjI0ZGFlLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE2VDA0NTQyOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTM5MGQzZjk3MWUyODNjMzgyYTZlYjQ1MjY3M2E0YjE3YmEzYzViMTM2ZTk4MTAwMmQ1MjcxYTY1NzVkNjY1YWMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.-_WHTP-UAWH0s4TwLORGBIgw6TUTZAkDjwOF7eogzkk)
![Screenshot 2024-04-10 at 18 19 44](https://private-user-images.githubusercontent.com/68184387/321316430-f4259b1a-787f-4db4-ae81-b57ccb5e48c9.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjM3ODQzNjksIm5iZiI6MTcyMzc4NDA2OSwicGF0aCI6Ii82ODE4NDM4Ny8zMjEzMTY0MzAtZjQyNTliMWEtNzg3Zi00ZGI0LWFlODEtYjU3Y2NiNWU0OGM5LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE2VDA0NTQyOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWM2MDlkZGExN2I1MjRiYTM0Njg0MzllMDEwNDkwZWRhMGNlZmEzYTMwMGI5Yzk4N2ZlZTNlODdiMTdkZWIyNzImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.u_w_y2ziOZljJysdCwiAdw4oEOpzsdQAD1FCiJ0VUMo)
UI Screen shot from my local after applying the fix.
Note:
This issue could be fixed an alternate way like below(
SpringQueryContext.java
)this.operationContext = OperationContext.asSession(systemOperationContext, authorizer, authentication, false);
but which seems to be a contradictory of this PR
@david-leifker could you please review and provide your thought on this?
Checklist