Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

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