Get document count

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Get document count

twchiam
Hi,
Anyone knows how to get the count of documents group by form name and search fields?

Can it be achieved through Orbeon search API?


Reply | Threaded
Open this post in threaded view
|

Re: Get document count

Alessandro  Vernet
Administrator
Hi Kenneth,

The search API will tell you how many documents match your search. That value will be on the search-total attribute on the root element of the response (<documents>). You can find more about this on:

https://doc.orbeon.com/form-runner/api/persistence/search.html

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Get document count

twchiam
The search results contains the document count and  all the involves documents. Is it possible for the search API to return the document counts only?
Reply | Threaded
Open this post in threaded view
|

Re: Get document count

Alessandro  Vernet
Administrator
Hi Kenneth,

search-total will tell you the number of documents matching the search. You can't tell the API to just return that number, and not the reference to the documents matching the search, but if you don't really care about them, you could in the query say <page-size>1</page-size><page-number>1</page-number>, and you'll have at most 1 document returned.

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet