Boolean operators

28 views
Skip to first unread message

Enrique Matos

unread,
Jun 15, 2015, 5:07:36 PM6/15/15
to digi...@googlegroups.com
Hi,

  I want to use the api boolean operators in a more complex way:
Lets say I want to search for zeus and I want (Images or Text) that are from year (1732 or 1904)
 I am trying something like this:
http://api.digitalnz.org/v3/records.json?api_key=[...]&text=zeus&page=1&per_page=20&facets=year,creator,category,rights&or[category][]=Images&or[category][]=Videos&and[year][]=1732&or[year][]=1904

here I am getting only the element of 1732
but if you search with
&text=zeus&page=1&per_page=20&facets=year,creator,category,rights&or[category][]=Images&or[category][]=Videos&and[year][]=1904
you get the element of 1904 and my goal is to get them both in only one query...

In other words I would like to find out if you have the expressibility to express queries like:

(A1 or A2) and (B1 or B2)

where the Ai and Bi are filters conditions like  [category][]=Images

also can you explain what is the meaning of using i in filters like i[category][]=Images instead of and[category][]=Images or or[category][]=Images

best regards
Enrique

Enrique Matos

unread,
Jul 1, 2015, 10:05:23 PM7/1/15
to digi...@googlegroups.com
Any Ideas about my question?

Fiona Fieldsend

unread,
Jul 1, 2015, 10:15:10 PM7/1/15
to digi...@googlegroups.com
Hi Enrique,
So sorry we missed your question! I've forwarded it to one of my colleagues ( who is travelling at the moment) and we'll have a response to you in the near future.
Fi
DigitalNZ Services


On Thursday, 2 July 2015, Enrique Matos <gar...@gmail.com> wrote:
Any Ideas about my question?

--

---
You received this message because you are subscribed to the Google Groups "DigitalNZ" group.
To unsubscribe from this group and stop receiving emails from it, send an email to digitalnz+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Chris McDowall

unread,
Jul 1, 2015, 10:26:17 PM7/1/15
to digi...@googlegroups.com, gar...@gmail.com
Hi Enrique,

Apologies for the slow response.

To the best of my knowledge, this query is not possible in a single step. I would union the results of two queries:


I used Newspapers rather than Videos in this example because in my query there were no videos with the search string "zeus" for the two years provided.

As for your second question, the short answer is that the small "i" that precedes filters in the DigitalNZ.org website URL strings is something that is used by our website to make sense of the URLs and prepare requests for the API. It is not a feature of the API itself. 

I hope that helps.

Chris

Enrique Matos

unread,
Jul 2, 2015, 5:16:38 PM7/2/15
to digi...@googlegroups.com, gar...@gmail.com
Hi,
Thanks for the answer... The multiple queries is a tricky solution specially when the expression has more complex expressions like:
(A1 or A2... An) and (B1 or B2...Bn) and .... (Z1 or Z2 ... Zn)
It is true that the more complex ones might not be that common but It would be nice if in the future you decide to include this more expressive queries in the API.

As for the "i" in the filters, I asked because when I send it to the API I get results too, do you ignore it? or make work with a specific logic?
Best regards
Enrique
Reply all
Reply to author
Forward
0 new messages