CSWSearch#
- class eodag.plugins.search.csw.CSWSearch(provider, config)[source]#
A plugin for implementing search based on OGC CSW
- Parameters:
provider (
str) – provider nameconfig (
PluginConfig) –Search plugin configuration:
api_endpoint(str) (mandatory): The endpoint of the provider’s search interfaceversion(str): OGC Catalogue Service version; default:2.0.2search_definition(dict[str, Any]) (mandatory):product_type_tags (
list[dict[str, Any]): dict of product type tagsresource_location_filter (
str): regex stringdate_tags (
dict[str, Any]): tags for start and end
metadata_mapping(dict[str, Any]): The search plugins of this kind can detect when a metadata mapping is “query-able”, and get the semantics of how to format the query string parameter that enables to make a query on the corresponding metadata. To make a metadata query-able, just configure it in the metadata mapping to be a list of 2 items, the first one being the specification of the query string search formatting. The later is a string following the specification of Python string formatting, with a special behaviour added to it. For example, an entry in the metadata mapping of this kind:completionTimeFromAscendingNode: - 'f=acquisition.endViewingDate:lte:{completionTimeFromAscendingNode#timestamp}' - '$.properties.acquisition.endViewingDate'
means that the search url will have a query string parameter named
fwith a value ofacquisition.endViewingDate:lte:1543922280.0if the search was done with the value ofcompletionTimeFromAscendingNodebeing2018-12-04T12:18:00. What happened is that{completionTimeFromAscendingNode#timestamp}was replaced with the timestamp of the value ofcompletionTimeFromAscendingNode. This example shows all there is to know about the semantics of the query string formatting introduced by this plugin: any eodag search parameter can be referenced in the query string with an additional optional conversion function that is separated from it by a#(seeformat_metadata()for further details on the available converters). Note that for the values in thefree_text_search_operationsconfiguration parameter follow the same rule. If the metadata_mapping is not a list but only a string, this means that the parameters is not queryable but it is included in the result obtained from the provider. The string indicates how the provider result should be mapped to the eodag parameter.
- __init__(provider, config)[source]#
- Parameters:
provider (
str)config (
PluginConfig)
Methods
__init__(provider, config)build_sort_by(sort_by_arg)Build the sorting part of the query string or body by transforming the
sort_byargument into a provider-specific string or dictionaryclear()Clear search context
discover_product_types(**kwargs)Fetch product types list from provider using discover_product_types conf
discover_queryables(**kwargs)Fetch queryables list from provider using
discover_queryablesconfget_assets_from_mapping(provider_item)Create assets based on the assets_mapping in the provider's config and an item returned by the provider
get_metadata_mapping([product_type])Get the plugin metadata mapping configuration (product type specific if exists)
get_product_type_cfg_value(key[, default])Get the value of a configuration option specific to the current product type.
get_product_type_def_params(product_type[, ...])Get the provider product type definition parameters and specific settings
get_sort_by_arg(kwargs)Extract the
sort_byargument from the kwargs or the provider default sort configurationlist_queryables(filters, ...[, ...])Get queryables
map_product_type(product_type, **kwargs)Get the provider product type from eodag product type
query([prep])Perform a search on a OGC/CSW-like interface
queryables_from_metadata_mapping([...])Extract queryable parameters from product type metadata mapping.
validate(search_params, auth)Validate a search request.
Attributes
pluginsauthnext_page_urlnext_page_query_objtotal_items_nbneed_count