Hi,

OpenCMIS has no default maximum. It returns whatever the repository sends. The repository may have a maximum, though. The getTotalNumItems() method SHOULD return the number of hits. If it returns -1 the repository didn't return this value, for what ever reason. In some cases the repository simply cannot return this number or it is to expensive to calculate this number. If the number is not provided, you have to iterate over the query results and count.

The code could look like this:


ItemIterable<QueryResult> results = session.query("SELECT ...", false)

long numOfHits = results.getTotalNumItems();
if(numOfHits < 0) {
  numOfHits = 0;
  for(QueryResult qr: results) {
    numOfHits++;
  }
}


Please see also the code samples on Apache Chemistry website:
https://chemistry.apache.org/docs/cmis-samples/samples/queries/index.html https://chemistry.apache.org/docs/cmis-samples/samples/lists/index.html


- Florian


Hi,

How do I the actual number of hits from a query in my java code
instead of just 100 (which seems to be default max).

Thanks
  • Cmis Samuel Jackvony
    • Re: Cmis Florian Müller

Reply via email to