Skip to content

Instantly share code, notes, and snippets.

@pkqk
Created October 1, 2015 16:21
Show Gist options
  • Save pkqk/e0ff40d2d5ebe7a02e71 to your computer and use it in GitHub Desktop.
Save pkqk/e0ff40d2d5ebe7a02e71 to your computer and use it in GitHub Desktop.
how to search catalog.data.gov by facet

The ckan search interface exposes it's SOLR backend so most of those docs are useful.

I haven't managed to find a way to list facets but once you've guessed the name of one:

http://catalog.data.gov/api/3/action/package_search?facet.field=license_id&fq=license_id:other-license-specified

or if the value has spaces in it you can quote the search license_title:"Creative Commons Attribution":

http://catalog.data.gov/api/3/action/package_search?facet.field=license_title&fq=license_title:%22Creative%20Commons%20Attribution%22

if you're looking for a nil value and not the empty string then excluding the range -field:[* TO *]:

http://catalog.data.gov/api/3/action/package_search?facet.field=license_id&fq=-license_id:[*%20TO%20*]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment