[ckan-dev] package_search by organisation name

Andy Lulham a.lulham at gmail.com
Fri Dec 21 23:52:07 UTC 2018


Thanks Jari. I gave that a go, but I don’t think it’ll work for me – I
get a timeout error due to the large number of organisations.


On Thu, 20 Dec 2018 at 13:16, Jari Voutilainen <jari.voutilainen at iki.fi> wrote:
>
> Hi,
>
> you can supply parameterall_fields for organization list to include the whole organization https://docs.ckan.org/en/2.8/api/index.html#ckan.logic.action.get.organization_list and use that to implement the search for specific organisation. But if you have many organizations it might get slow since the results come from the database instead of solr.
>
> Regards
> Jari
>
> On Thu, Dec 20, 2018 at 12:52 PM Andy Lulham <a.lulham at gmail.com> wrote:
>>
>> Thanks, Matt – that’s very helpful to know!
>>
>> A plugin is a possibility – I can suggest it to the developers, but
>> it’s outside of my control. Do you know of anything off-the-shelf, or
>> would it need to be bespoke? I took a look here:
>> https://extensions.ckan.org but didn’t find anything.
>>
>> As an alternative approach, I wonder if there are some other searches
>> I could do? I’m not averse to running multiple searches, but it looks
>> like CKAN only provides the possibility of searching by packages,
>> resources or tags. Groups and organizations can only be listed, by the
>> looks of things.
>>
>> Thanks again!
>> Andy
>>
>> On Tue, 18 Dec 2018 at 11:29, Matthew Fullerton
>> <matt.fullerton at gmail.com> wrote:
>> >
>> > Hi Andy,
>> >
>> > I hate to say, but I don't think that's possible because that is stored against or indexed with the packages (datasets). It would be possible to make this happen with a plugin, but I think that doesn't help you with your problem?
>> >
>> > Best,
>> > Matt
>> >
>> > On Tue, 18 Dec 2018 at 12:15, Andy Lulham <a.lulham at gmail.com> wrote:
>> >>
>> >> Thanks Matthew! That perfectly answers my question!
>> >>
>> >> Unfortunately, it turns out I got my question slightly wrong :(
>> >>
>> >> I’m actually interested in searching by the organisation _title_, not
>> >> _name_. Both would also be fine, but I really need a way to ensure the
>> >> organisation title is included in the search.
>> >>
>> >> So for example, using your solution the following works, because
>> >> there’s an organisation with the name “organizacion-de-pepe-foo”:
>> >> https://demo.ckan.org/api/3/action/package_search?q=organization:%22organizacion-de-pepe-foo%22
>> >>
>> >> The same organisation has the title “organizacion de pepe foo”. But
>> >> the following search doesn’t work, presumably because it’s not
>> >> searching the organisation title field:
>> >> https://demo.ckan.org/api/3/action/package_search?q=organization:%22organizacion%20de%20pepe%20foo%22
>> >>
>> >> In case it’s useful, the relevant ticket is here:
>> >> https://github.com/pwyf/iati-decipher/issues/93
>> >>
>> >> Thanks again Matthew, and apologies for my error.
>> >>
>> >> Andy
>> >>
>> >>
>> >> On Tue, 18 Dec 2018 at 05:44, Matthew Fullerton
>> >> <matt.fullerton at gmail.com> wrote:
>> >> >
>> >> > https://demo.ckan.org/api/3/action/package_search?q=organization:opendata_rco
>> >> >
>> >> > Seems to do it
>> >> >
>> >> > -Matt
>> >> >
>> >> > On Mon, 17 Dec 2018 at 18:49, Andy Lulham <a.lulham at gmail.com> wrote:
>> >> >>
>> >> >> Hi there,
>> >> >>
>> >> >> The following API URL returns various packages, including one from an
>> >> >> organisation named “opendata_rco”:
>> >> >> https://demo.ckan.org/api/3/action/package_search
>> >> >>
>> >> >> I’d like to create an API query that just returns the package(s) from
>> >> >> this organisation.
>> >> >>
>> >> >> I guess this query would be something like:
>> >> >> https://demo.ckan.org/api/3/action/package_search?q=organization:name=
>> >> >> opendata_rco
>> >> >>
>> >> >> …but that’s obviously not quite right, since it returns zero results.
>> >> >>
>> >> >> Could someone enlighten me as to the correct query? Thanks in advance!
>> >> >>
>> >> >> Andy
>> >> >> _______________________________________________
>> >> >> ckan-dev mailing list
>> >> >> ckan-dev at lists.okfn.org
>> >> >> https://lists.okfn.org/mailman/listinfo/ckan-dev
>> >> >> Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
>> >> >
>> >> > _______________________________________________
>> >> > ckan-dev mailing list
>> >> > ckan-dev at lists.okfn.org
>> >> > https://lists.okfn.org/mailman/listinfo/ckan-dev
>> >> > Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
>> >> _______________________________________________
>> >> ckan-dev mailing list
>> >> ckan-dev at lists.okfn.org
>> >> https://lists.okfn.org/mailman/listinfo/ckan-dev
>> >> Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
>> >
>> > _______________________________________________
>> > ckan-dev mailing list
>> > ckan-dev at lists.okfn.org
>> > https://lists.okfn.org/mailman/listinfo/ckan-dev
>> > Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
>> _______________________________________________
>> ckan-dev mailing list
>> ckan-dev at lists.okfn.org
>> https://lists.okfn.org/mailman/listinfo/ckan-dev
>> Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
>
>
>
> --
> Jari Voutilainen
> jari.voutilainen at iki.fi
> 040-5538558
> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> https://lists.okfn.org/mailman/listinfo/ckan-dev
> Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev



More information about the ckan-dev mailing list