Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.

search with SQL - get total matches count

Avatar

Level 1

          I am currently using JQOM search for query. However I didn't find TotalMatches on QueryResult class like SearchResult object using QueryBuilder.

          QueryObjectModelFactory qomFactory = session.getWorkspace().getQueryManager().getQOMFactory();
          .

          .

          .         

          Query query = qomFactory.createQuery(qomFactory.selector(JcrConstants.NT_UNSTRUCTURED, Constants.SELECTOR), and, null, null);

          query.setOffset(0);

          query.setLimit(5);

          QueryResult result = query.execute();

          long size = result.getRows().getSize()

          the size would have value of only 5 even though i have 10 records 

           QueryResult class does not have any count method. I have to get NodeIterator or RowIterator to navigate to the result. These iterators will hold only            number of rows set in setLimit method.

           I need to get total matches count even after setting offset and limit on the query? 

0 Replies