在 lucene 中,我可以执行以下操作
doc.GetField("mycustomfield").StringValue();
这将检索索引文档中列的值。
我的问题,同样的
'doc'
,有没有办法得到Doc. Id
?卢克展示了它,因此必须有办法解决这个问题。我需要它来删除有关更新的文档。我搜索了文档,但没有找到在 GetField 中使用的术语,或者是否已经有另一种方法。
最佳答案
原来你必须这样做:
var hits = searcher.Search(query);
var result = hits.Id(0);
与
var results = hits.Doc(i);
var docid = results.<...> //there's nothing I could find there to do this
关于.net - 在 Lucene 中获取文档 ID,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1296709/