Public
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Helper

Question about Lithium API

Hi everyone, 

I am using Lithium Community REST API v2 to get question list but I encountered a strange issue. 

I want to know if the cases I'm interested in are answered, so I use this query string "SELECT distinct topic.id FROM messages WHERE topic.id in ('id1','id2'...) and is_solution = true". For test, I have 4 ids and I just get random result in different requests while all the 4 questions are answered. For example, at the first request, I got result with 2 item, but got result with 4 items with the same request at second request.

Any help will be appreciated!

7 Replies 7

@CharlesHe - Tried this query on my side and it worked as expected, I have got the same result on every hit. 

Give kudos if you find my posts helpful or mark solution if it answers your query.
Tariq

Hi Tariq,
Thanks for your help.
If distinct keyword not supported, why no error exists?
I change my query string to "SELECT topic.id FROM messages WHERE topic.id in ('id1','id2'...) and is_solution = true", the issue still exists.
So do you have any suggestion to get what I want ?
Thanks,
Charles

@CharlesHe - I thought distinct was not supported till yet, however, this is working with LIQL. Regarding the issue you are facing, I gave it a try and it worked as expected, I was getting the same result on every hit. This might be an issue on your stage which can be fixed from lithium. 

Give kudos if you find my posts helpful or mark solution if it answers your query.
Tariq
Khoros Alumni (Retired)

SELECT DISTINCT is indeed not a supported statement in LiQL.  If what you are looking for are actually threads (which consist of multiple messages (!)) that are solved, then what you are looking for would be the following:

SELECT id FROM messages WHERE depth = 0 AND conversation.solved = true

 This will return the id of the topic message for solved threads.


Khoros Best Practice until August 2019. Onwards posting as Claudius.
Learn how to master Khoros. Learn Best Practice in the Community Documentation
If you appreciate my efforts, please give me a kudo ↓
Accept as solution to help others find it faster.

@ClaudiusH - I was under the same impression, however, the query shared by @CharlesHe is working on API browser. 

Give kudos if you find my posts helpful or mark solution if it answers your query.
Tariq
Helper

@TariqHussain@ClaudiusH-Thanks for your help.

Below is what I got, I want to get 4 questions which are answered already, but got different results in different requests. You can see that I first got 3 items and later got 4 items. It's weird. So do you have any idea why this happens?10.gif

Thanks a lot,

Charles

 

Khoros Alumni (Retired)

Normally different query results are caused by different users and their different permissions to areas. But from your recording it looks like you are executing the same query with the very same user. So that won't explain.

A few years ago when horizontal scaling (HS) was initially activated there were some anomalies like that (identical queries returning different result), but these issues were resolved already years ago as well. Do you know if your community is using HS?

Since this issue seems very reproducable with your instance I would recommend to create a case with Lithium support to get this investigated.

Khoros Best Practice until August 2019. Onwards posting as Claudius.
Learn how to master Khoros. Learn Best Practice in the Community Documentation
If you appreciate my efforts, please give me a kudo ↓
Accept as solution to help others find it faster.

Welcome to the Technology board!

Curious about our platform? Looking to connect on social technology? You've come to the right place!

Are you a Khoros customer? For direct assistance from our Support team, please visit the Support Forum.