isogeo_pysdk.api.routes_search module¶
Isogeo API v1 - API Routes for Search
See: http://help.isogeo.com/api/complete/index.html#definition-resource
-
class
isogeo_pysdk.api.routes_search.
ApiSearch
(api_client=None)¶ Bases:
object
Routes as methods of Isogeo API used to manipulate metadatas (resources).
Add shares list to the tags attributes in search.
Parameters: search (MetadataSearch) – search to add shares
-
search
(self, group=None, query='', share=None, specific_md=(), include=(), bbox=None, poly=None, georel=None, order_by='_created', order_dir='desc', page_size=20, offset=0, augment=False, check=True, expected_total=None, tags_as_dicts=False, whole_results=False)¶ Search within the resources shared to the application. It’s the mainly used method to retrieve metadata.
Parameters: - group (str) – context to search. Pass a workgroup UUID to search within a group or pass None (default) to search in a global context.
- query (str) – search terms and semantic filters. Equivalent of q parameter in Isogeo API. It could be a simple string like oil or a tag like keyword:isogeo:formations or keyword:inspire-theme:landcover. The AND operator is applied when various tags are passed.
- bbox (tuple) – Bounding box to limit the search. Must be a 4 tuple of coordinates in WGS84 (EPSG 4326). Could be associated with georel.
- poly (str) – Geographic criteria for the search, in WKT format. Could be associated with georel.
- georel (str) –
geometric operator to apply to the bbox or poly parameters. Available values:
- ’contains’,
- ’disjoint’,
- ’equals’,
- ’intersects’ - [APPLIED BY API if NOT SPECIFIED]
- ’overlaps’,
- ’within’.
- order_by (str) –
sorting results. Available values:
- ’_created’: metadata creation date [DEFAULT if relevance is null]
- ’_modified’: metadata last update
- ’title’: metadata title
- ’created’: data creation date (possibly None)
- ’modified’: data last update date
- ’relevance’: relevance score calculated by API [DEFAULT].
- order_dir (str) –
sorting direction. Available values:
- ’desc’: descending
- ’asc’: ascending
- page_size (int) – limits the number of results. Useful to paginate results display. Default value: 100.
- offset (int) – offset to start page size from a specific results index
- share (str) – share UUID to filter on
- specific_md (tuple) – list of metadata UUIDs to filter on
- include (tuple) – subresources that should be returned. See:
enums.MetadataSubresources
. - whole_results (bool) – option to return all results or only the page size. False by DEFAULT.
- check (bool) – option to check query parameters and avoid erros. True by DEFAULT.
- augment (bool) – option to improve API response by adding some tags on the fly (like shares_id)
- expected_total (int) – if different of None, value will be used to paginate. Can save a request.
- tags_as_dicts (bool) – option to store tags as key/values by filter.
Return type: Example: # get the search context (without results), useful to populate a search widget search_context = isogeo.search(page_size=0, whole_results=0, augment=1) # search the 10 first results in alphabetically order search_10 = isogeo.search( page_size=10, include="all", order_by="title", order_dir="asc", expected_total=search_context.total ) # returns all results, filtering on vector-datasets search_full = isogeo.search( query="type:vector-dataset", order_by="title", order_dir="desc", include="all", augment=1, whole_results=1 )
-
search_metadata_asynchronous
(total_results, max_workers=10, **kwargs)¶ Meta async method used to request big searches (> 100 results), using asyncio. It’s a private method launched by the main search method.
Parameters: - total_results (int) – total of results to retrieve
- max_workers (int) – maximum number of thread to use
python.concurrent.futures
Return type: