简体   繁体   中英

How can I retrieve the total number of documents indexed by Lucene in 3.0.2?

我正在搜索一些文档,我想返回匹配的文档数量与索引的文档数量。

You could create a MatchAllDocsQuery which according to the javadocs states:

A query that matches all documents.

Otherwise perhaps the IndexReader might be useful:

IndexReader.open("path/to/index").numDocs();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM