Skip to content

Commit

Permalink
Fix query string construction
Browse files Browse the repository at this point in the history
  • Loading branch information
chandra-tacc committed Nov 6, 2023
1 parent b51c41f commit 47aa370
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions server/portal/apps/workspace/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,12 @@ def listing(self, client, request):
return data

def search(self, client, request):

'''
Search using tapis in specific portal with providing query string.
Additonal parameters for search:
limit - limit param from request, otherwise default to 10
offset - offset param from request, otherwise default to 0
'''
query_string = request.GET.get('query_string')

limit = int(request.GET.get('limit', 10))
Expand All @@ -197,10 +202,10 @@ def search(self, client, request):

sql_queries = [
f"(tags IN ('portalName: {portal_name}')) AND",
f"(name like '%{query_string}%') OR",
f"((name like '%{query_string}%') OR",
f"(archiveSystemDir like '%{query_string}%') OR",
f"(appId like '%{query_string}%') OR",
f"(archiveSystemId like '%{query_string}%')",
f"(archiveSystemId like '%{query_string}%'))",
]

data = client.jobs.getJobSearchListByPostSqlStr(
Expand All @@ -212,7 +217,6 @@ def search(self, client, request):
},
select="allAttributes"
)

return data

def delete(self, request, *args, **kwargs):
Expand Down

0 comments on commit 47aa370

Please sign in to comment.