Skip to content

Commit

Permalink
Implement search query in Invenio-compatible plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
davelopez committed May 3, 2024
1 parent 34fdaa0 commit 2eb12c7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/galaxy/files/sources/invenio.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ class InvenioRDMFilesSource(RDMFilesSource):

plugin_type = "inveniordm"
supports_pagination = True
supports_search = True

def __init__(self, **kwd: Unpack[RDMFilesSourceProperties]):
super().__init__(**kwd)
Expand Down Expand Up @@ -157,7 +158,7 @@ def _list(
writeable = opts and opts.writeable or False
is_root_path = path == "/"
if is_root_path:
records = self.repository.get_records(writeable, user_context, limit=limit, offset=offset)
records = self.repository.get_records(writeable, user_context, limit=limit, offset=offset, query=query)
return cast(List[AnyRemoteEntry], records)
record_id = self.get_record_id_from_path(path)
files = self.repository.get_files_in_record(record_id, writeable, user_context)
Expand Down Expand Up @@ -230,6 +231,9 @@ def get_records(
size, page = self._to_size_page(limit, offset)
params["size"] = size
params["page"] = page
if query:
params["q"] = query
params["sort"] = "bestmatch"
response_data = self._get_response(user_context, request_url, params=params)
return self._get_records_from_response(response_data)

Expand Down

0 comments on commit 2eb12c7

Please sign in to comment.