lucene - 是否可以遍历存储在 Lucene Index 中的文档?

标签 lucene lucene.net

我有一些文档存储在带有 docId 字段的 Lucene 索引中。
我想获取存储在索引中的所有 docId。还有一个问题。文档数量约为 300 000,所以我更愿意以大小为 500 的块获取此 docIds。是否可以这样做?

最佳答案

IndexReader reader = // create IndexReader
for (int i=0; i<reader.maxDoc(); i++) {
    if (reader.isDeleted(i))
        continue;

    Document doc = reader.document(i);
    String docId = doc.get("docId");

    // do something with docId here...
}

关于lucene - 是否可以遍历存储在 Lucene Index 中的文档?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2311845/

相关文章:

Lucene.Net - 返回所有文档

java - 如何在 JBoss7.1 中使用 Infinispan 查询

java - 如何在我的远程服务器上部署 elasticsearch-head 或其他浏览器前端监控工具

c# - 我如何使用 Lucene.Net 索引 PDF 文件?

geolocation - Lucene.net 邻近搜索

lucene.net - 我是否需要在 StandardAnalyzer 上调用 .Dispose(),或者 IndexWriter 上的 .Dispose() 是否处置其后代?

lucene - Solr 索引似乎有效 - 但没有返回任何结果

java - 在 Solr 组件的准备方法中执行分布式搜索

lucene - Lucene索引自定义收集器的工作方式

java - 在 Solr4 中应用自定义 CharTokenizer