Skip to content

Commit

Permalink
Use homedir to isolate the search.
Browse files Browse the repository at this point in the history
  • Loading branch information
chandra-tacc committed Nov 7, 2023
1 parent b51c41f commit 634ffbb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion server/portal/apps/site_search/api/unit_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def test_file_search_util(mock_file_search, regular_user):
[{'name': 'testfile',
'path': '/path/to/testfile'}]}
client = regular_user.tapis_oauth.client
res = files_search(client, 'test_query', 'test_system')
res = files_search(client, 'test_query', 'test_system', '/',)

mock_file_search.assert_called_with(client, 'test_system', '/',
query_string='test_query',
Expand Down
8 changes: 4 additions & 4 deletions server/portal/apps/site_search/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ def cms_search(query_string, offset=0, limit=10):
return total, results


def files_search(client, query_string, system, filter=None, offset=0, limit=10):
res = search_operation(client, system, '/', offset=offset, limit=limit,
def files_search(client, query_string, system, path, filter=None, offset=0, limit=10):
res = search_operation(client, system, path, offset=offset, limit=limit,
query_string=query_string, filter=filter)
return (res['count'], res['listing'])

Expand Down Expand Up @@ -65,7 +65,7 @@ def get(self, request, *args, **kwargs):
and ('siteSearchPriority' in conf and conf['siteSearchPriority'] is not None))
client = request.user.tapis_oauth.client if (request.user.is_authenticated and request.user.profile.setup_complete) else service_account()
(public_total, public_results) = \
files_search(client, qs, public_conf['system'], filter=filter,
files_search(client, qs, public_conf['system'], public_conf.get("homeDir", "/"), filter=filter,
offset=offset, limit=limit)
response['public'] = {'count': public_total,
'listing': public_results,
Expand All @@ -84,7 +84,7 @@ def get(self, request, *args, **kwargs):
and ('siteSearchPriority' in conf and conf['siteSearchPriority'] is not None))
client = request.user.tapis_oauth.client
(community_total, community_results) = \
files_search(client, qs, community_conf['system'], filter=filter,
files_search(client, qs, community_conf['system'], community_conf.get("homeDir", "/"), filter=filter,
offset=offset,
limit=limit)
response['community'] = {'count': community_total,
Expand Down

0 comments on commit 634ffbb

Please sign in to comment.