Forum Discussion
Hi Claudius,
I'd suggest just tweaking the search query to return only root messages. You can do this by adding "is_root:true" to the q parameter for the search.
For example:
<#assign rest_query = "/boards/id/" + pid + "/search/messages?q=is_root:true&openresponse=true&sort_by=-topicPostDate&page_size=" + results_list_size /> <@component id="forums.widget.message-list-panel" messages="rest_v1:"+rest_query style="wide" numMessages="conv:"+results_list_size />
Hopefully this helps. Let me know if I misunderstood what you're trying to do.
Regards,
Adam
- Claudius13 years agoBoss
Hi Adam,
thanks for your reply. I want to list all threads that have replies, but no solutions yet. My original call didn't do that as I was postprocessing the data via<#if thread.solutions?size == 0 || thread.solutions.solution?size == 0>
Obviously because of my misleading example your's doesn't do that either. Is there any URL parameter you can think of that would allow me to return only messages in a thread without a solution? Searching Lithosphere and digging through the JavaDoc I could only find ways to pull threads with solutions. Yet for Moderators it's much more interesting to find those without.
- AdamN13 years agoKhoros Oracle
Oh, I see now... You want unsolved (no solution) posts. Let's try this instead:
<#assign rest_query = "/boards/id/" + pid + "/search/messages?q=is_root%3Atrue%20AND%20!(solved%3Atrue)&sort_by=-topicPostDate&page_size=" + results_list_size /> <@component id="forums.widget.message-list-panel" messages="rest_v1:"+rest_query style="wide" numMessages="conv:"+results_list_size />
Decoded, the query (q) portion of the rest call looks like this:
is_root:true AND !(solved:true)
So this gives us root messages that are not solved. You may ask why I didn't do "solved:false", and that's because the solved field isn't necessarily an actual boolean value (only true or false). It doesn't have a value unless the thread is actually solved, in which case it's set to "true". So to get the cases where it's not solved, we just negate it instead.
I hope this helps!
Regards,
Adam