I'm doing a POC to send multiple Criteria through Taxonomy API to retrieve the item reference ID from the ITEM_CATEGORIES_AND_KEYWORDS
table. If I've only one Criteria to send, then I am able to retrieve the item using the following Java code:
String strTaxURI = "tcm:396-65311-1024", strTaxKeywordURI = "tcm:396-223309-1024";
TaxonomyKeywordCriteria taxonomyKeywordCriteria = new
TaxonomyKeywordCriteria(strTaxURI, strTaxKeywordURI, false);
Criteria myCriteria =null;
myCriteria = taxonomyKeywordCriteria;
myQuery.setCriteria(myCriteria);
SortParameter sortParameter = new SortParameter(SortParameter.ITEMS_TITLE, SortParameter.ASCENDING);
myQuery.addSorting(sortParameter);
myQuery.setResultFilter(new LimitFilter(20));
String[] itemURIs = myQuery.executeQuery();
String strOutput = "";
System.out.println("itemURIs.length???:::ttt"+itemURIs.length);
for (int i = 0; i < itemURIs.length; i++) {
strOutput += itemURIs[i] + ", ";
}
%>
<body>
<%=strOutput%>
</body>
Now if I've got multiple Keyword and Taxonomy IDs to send to the database, to retrieve the combination of items, I need to do an in clause
and and clause
to retrieve the items from the database.
select * from ITEM_CATEGORIES_AND_KEYWORDS where KEYWORD_ID In( 222900,223309) and TAXONOMY_ID In(65311,65175) and PUBLICATION_ID=396;
But I'm facing a problem to create the same Criteria of In clause
and And clause
from Java. I've tried out a few options but I'm not able to retrieve the result of what I'm getting by executing a SQL query.
Can anyone help me with what needs to be done to do the setup for this Criteria from Java, or can someone tell me what needs to be configured, so that I can able to see the query being formed in the server console, to check how it is forming?