Using Java how would you find out the number of documents in an lucene index?
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
IndexReader contains the methods you need, in particular, numDocs
http://lucene.apache.org/core/3_6_0/api/all/org/apache/lucene/index/IndexReader.html#numDocs()
When using Hibernate Search, it is possible to obtain a Lucene
IndexReader
instance through the Hibernate Search API and then usereader.numDocs()
as already mentioned in previous answers.Using java you can find the number of documents like this :
The official documentation: http://lucene.apache.org/java/2_4_0/api/org/apache/lucene/index/IndexReader.html#numDocs()