[ckan-discuss] Search by "Extras" field
David Read
david.read at okfn.org
Tue Mar 9 20:15:49 GMT 2010
The simplest way to do this is with the search API. You can do
something like this:
http://ckan.net/api/search/package?department=Her+Majesty's+Treasury
The docs ( http://knowledgeforge.net/ckan/doc/ckan/api.html ) show
that 'department' is in a small hard-coded list of extra fields that
are indexed in the search and accessible through the API. So as it is
right now, 'ministry' won't work in this way, because we've not needed
this flexibility up until now.
It might make sense to have this list configurable in the config file.
Alternatively we could just index all extra fields and when parsing
the search query, if the key isn't one of the known fields or search
commands then search the extra fields for it. Perhaps it would be best
to allow key prefixed with 'extra-', giving
"?extra-ministry=Treasury". Rufus, what do you think?
David
On 9 March 2010 19:23, Colin Calnan <colin at raisedeyebrow.com> wrote:
> Is there anyway to list Packages by "extras" fields via the API?
>
> Would it be possible to call ckan.net/api/rest/package/extrasKey-extrasValue
> ?
>
> We're using extras fields to hold information about government ministries,
> and it would be great if we could list all packages that are assigned a
> ministry. Right now to get that data I have to loop through every package
> and build the list as I go along.
>
> Regards,
> Colin
> --
> *Colin Calnan | Front End Developer*
> Raised Eyebrow Web Studio
> www.raisedeyebrow.com <http://www.raisedeyebrow.com>
> T. 604.684.2498, ext. 5 | E. colin at raisedeyebrow.com
> UFCW Local 120B
>
>
> _______________________________________________
> ckan-discuss mailing list
> ckan-discuss at lists.okfn.org
> http://lists.okfn.org/mailman/listinfo/ckan-discuss
>
More information about the ckan-discuss
mailing list