I need to find out if a document exists but the documents saved in the Solr server are pretty big so if I do a classic search to retrieve the document with a specified id
and the document is returned it takes too much time to process.
Is there a possibility to return for example the number of matching documents without retrieving the actual documents ?
Yes, this is possible. You can set rows=0 when submitting a query, execute it. No actual documents are returned.
In the response, you can read the numFound attribute from response. If numFound=1 (since this is for ID), then the document is found.
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