Searching CKAN

From CKAN

(Redirected from Searching Packages)
Jump to: navigation, search

Contents

Searching CKAN Datasets

NB: example links here are to http://thedatahub.org/ but this documentation applies to any CKAN instance

You can search datasets in a CKAN instance via:

  1. The Web Interface: see below
  2. The API: see http://readthedocs.org/docs/ckan/en/latest/api.html
  3. SPARQL: see e.g. http://semantic.ckan.net/ and RDF Docs (NB: you need to rdfized the data and load it in a triple-store!)

Here we only document option 1.

Getting Started

To do a search via the web interface you use the search form available on the home page or on the dataset search page

Standard Full-Text Search

The search system performs a full-text search of most of the dataset fields. e.g.:

In addition to returning matching datasets the search also returns a list of tags that match. This can be useful for refining the search of looking at datasets tagged with a particular tag.

Structured Search

In addition you can also search on any specific attribute by prefixing with the attribute name, for example, searching for:

title:chemistry

Will only find datasets which have chemistry in their title.

More usefully:

tags:chemistry

Will only find datasets which have the tag chemistry.

You can combine structured searches with standard, unstructured, full-text search:

chemistry tags:ocean

Will find datasets matching full-text search on chemistry AND having tag ocean.

Full Solr/Lucene Search

For CKAN instances running against a solr search backend (please check with your CKAN admin, but it is the default for CKAN >= 1.5) you can use the full range of Solr syntax - cf http://wiki.apache.org/solr/SolrQuerySyntax.

For example, to search for datasets that do not have a specific value:

 -field:[* TO *]

(The range query is a way to express "any value").

Examples

The best way to demonstrate the search is to give some examples:

curl http://thedatahub.org/api/action/package_search -d '{"q": "groups:lodcloud", "sort": "metadata_modified desc"}'
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox