I am trying to fetch Knowledge Articles based on Data Category through the below dynamic Soql query.
String dynamicQuery = 'SELECT Id, Title FROM Knowledge__kav ' +
'WHERE PublishStatus = \'Online\' ' +
'WITH DATA CATEGORY Topics__c AT ({0})';
List<Knowledge__kav> kavList = Database.query(String.format(dynamicQuery, DynamicTopics));
Wherein 'DynamicTopics' is a list of String having the data category name.
The problem i am facing here is, i get all the articles without distinguishing which data category it belongs to.
I cannot put this in for loop as it might hit the limit.
I want the article to be fetched along with their data category or something from which i can distinguishing it with the data category
Can you please help me with this?