filter by more than one content partner or decade at a time?

19 views
Skip to first unread message

Sarah Wheaton

unread,
Aug 16, 2017, 9:05:41 PM8/16/17
to DigitalNZ

Hi Digital NZ 

Is there a way to filter by more than one facet value in a single call? lets say I have something like:

http://api.digitalnz.org/v3/records.json?api_key=<my_key>&text=stoat&per_page=20&and[content_partner]=National+Library+of+New+Zealand and want to return results from both National Libraries and TV3.



Cheers
Sarah

dan.c...@dia.govt.nz

unread,
Aug 17, 2017, 4:25:16 AM8/17/17
to DigitalNZ
Hi Sarah,

There sure is. You can combine fields with an OR operator like this:

eg Content partner:
&or[content_partner][]=National+Library+of+New+Zealand&or[content_partner][]=TV3


eg Decade
&or[decade][]=2010&or[decade][]=2000


Doing both of the above at once is a little more complicated in that you have to nest parameters correctly to get the fields grouping and combining correctly:
&and[or][content_partner][]=National+Library+of+New+Zealand&and[or][content_partner][]=TV3&and[and][or][decade][]=2010&and[and][or][decade][]=2000

Which is essentially a couple (or more) of each of these
- `&and[or][content_partner][]=`
- `&and[and][or][decade][]=`

Hopefully that helps, let us know if there is anything else we can help with.

Cheers
Dan

Sarah Wheaton

unread,
Aug 26, 2017, 2:04:16 AM8/26/17
to DigitalNZ
You guys are great. Thanks very much for your help :)
Reply all
Reply to author
Forward
0 new messages