package_search
Searches for packages satisfying a given search criteria.
This action accepts Solr search query parameters (details below), and returns a dictionary of results, including dictized datasets that match the search criteria, a search count, and also facet information.
Solr Parameters:
For more in depth treatment of each parameter, please read the Solr Documentation.
This action accepts a subset of Solr's search query parameters.
The following advanced Solr parameters are supported as well. Note that some of these are only available on particular Solr versions. See Solr's dismax and edismax documentation for further details on them:
qf, wt, bf, boost, tie, defType, mm
Examples:
q=flooddatasets containing the word flood, floods, or floodingfq=tags:economydatasets with the tag economyfacet.field=["tags"] facet.limit=10 rows=0top 10 tags
Please either remove this field by clicking "Open JSON editor" in the Body dropdown or set it to true (the default value) or false.
apiTokenHeaderAuthorization<token>CKAN API token
application/json- body
q?stringthe solr query.
fq?stringany filter queries to apply. Note: +site_id:{ckan_site_id} is added to this string prior to the query being executed.
fq_list?array<string>additional filter queries to apply.
sort?stringsorting of the search results. Default: 'score desc, metadata_modified desc'. As per the Solr documentation, this is a comma-separated string of field names and sort-orderings.
rows?integerthe maximum number of matching rows (datasets) to return. (default: 10, upper limit: 1000 unless set in site's configuration ckan.search.rows_max)
start?integerthe offset in the complete result for where the set of returned datasets should begin.
facet?booleanwhether to enable faceted results. Default: True
facet.mincount?integerthe minimum counts for facet fields should be included in the results.
facet.limit?integerthe maximum number of values the facet fields return. A negative value means unlimited. This can be set instance-wide with the search.facets.limit config option. Default is 50.
facet.field?array<string>the fields to facet upon. Default empty. If empty, then the returned facet information is empty.
include_drafts?booleanif True, draft datasets will be included in the results. A user will only be returned their own draft datasets, and a sysadmin will be returned all draft datasets. Optional, the default is False.
include_deleted?booleanif True, deleted datasets will be included in the results (site configuration ckan.search.remove_deleted_packages must be set to False). Optional, the default is False.
include_private?booleanif True, private datasets will be included in the results. Only private datasets from the user’s organizations will be returned and sysadmins will be returned all private datasets. Optional, the default is False.
use_default_schema?booleanuse default package schema instead of a custom schema defined with an IDatasetForm plugin (default: False)
curl -X POST 'http://localhost:5000/api/3/action/package_search' \ -H 'Content-Type: application/json' \ -d '{}'