pyslk.gen_search_query

pyslk.gen_search_query#

pyslk.gen_search_query(key_value_pairs: str | list[str] | set[str], recursive: bool = False, search_query: str | None = None) str#

Generates a search query that searches for the listed resources

A search query will be generated which connects all elements of ‘resources’ with and ‘or’. A ‘resource’ (an element of ‘resources’) might be one of these:

  • a filename with full path (e.g. /arch/bm0146/k204221/INDEX.txt)

  • a filename without full path (e.g. INDEX.txt)

  • a regex describing a filename (e.g. /arch/bm0146/k204221/.*.txt)

  • a namespace (e.g. /arch/bm0146/k204221 or /arch/bm0146/k204221/)

Details are given in the slk_helpers documentation at https://docs.dkrz.de

Parameters:
  • key_value_pairs (str or list or set) – list of key-value pairs connected via an operator

  • recursive (bool) – do recursive search in the namespaces

  • search_query (str) – an existing search query to be extended

Returns:

generated search query

Return type:

str