How can I determine the total number of documents in a Solr index using Solrj?
After hours of searching on my own, I actually have an answer (given below); I'm only posting this question so others can find the solution more easily.
If you are looking for the physical on-disk size of the index, you can look at 'data/index' folder under 'dataDir' per the definition in solrconfig. xml. For eg. in example index, it is example/solr/data/index folder.
A Solr index can accept data from many different sources, including XML files, comma-separated value (CSV) files, data extracted from tables in a database, and files in common file formats such as Microsoft Word or PDF.
Full index takes about 40 hours using DB. There are some factors that might slowing you down: Memory.
Here's what I'm using. Is this canonical? Is there a better way?
SolrQuery q = new SolrQuery("*:*"); q.setRows(0); // don't actually request any data return server.query(q).getResults().getNumFound();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With