Liql query with OR/AND
Hi,
I am trying to create a query that will pull articles with specific labels.
For example, I'd like to show only articles that have labels 'Cats' or 'Dogs' or 'Birds' or any different combinations of these 3 labels.
My query is:
SELECT * FROM messages WHERE (labels.text='Cats' OR labels.text='Dogs' OR labels.text='Birds')
So, in this case OR works like AND and I am getting only articles where all these labels are included.
I am not getting articles with only 'Cats' labels or only 'Dogs' labels.
I am wondering if it is an expected behavior of OR and how it is different from AND, and if there is a way to pull articles with at least one of these labels without running each separate query for each label?
Thank you,
Yulia
Hi Yulia-Anaplan. OR has a fairly limited use within LiQL. As you saw earlier, OR will act as an AND in the use case you tried. Generally, OR is supported in conjunction with MATCHES. Keyword Searches in a LiQL Query shows an example. I see that labels.text does support MATCHES when used as a constraint on messages collection queries. That might get you closer to what you need.