Gravatar for mark.angus@sitesystems.ca

Question by mark, Dec 16, 2014 9:16 AM

How do I programmatically check the number of documents in a particular source?

Hi, How do I programmatically check the number of documents in a particular source by source name?

Thanks

2 Replies
Gravatar for jflheureux@coveo.com

Answer by Jean-François L'Heureux, Dec 16, 2014 9:37 AM

You can use the Coveo Admin Service GetNumberOfDocumentsInSource call.

Gravatar for mark.angus@sitesystems.ca

Comment by mark, Dec 16, 2014 9:59 AM

Hi, I appreciate the speedy reply. I there a way using the search api instead? I will not have access to the admin api.

Thanks.

Gravatar for jflheureux@coveo.com

Comment by Jean-François L'Heureux, Dec 16, 2014 10:33 AM

Using the REST Search API, you will only have the number of documents you have permission to access in the source. If this is a public source, there is no problem. You can just do the @syssource=="Your source name" query, ask for only one result and ask for no duplicate filtering. Then, check the totalCount property to have the number of documents in the source

Gravatar for mlaporte@coveo.com

Answer by Martin Laporte, Dec 16, 2014 9:24 AM

In the admin tool this is available in the info for each source.

Ask a question