获取Lucene的Doc ID(Getting the Doc ID in Lucene)
在lucene,我可以做以下事情
doc.GetField("mycustomfield").StringValue();这将检索索引文档中列的值。
我的问题,对于同一个'doc' ,是否有办法获得Doc. Id Doc. Id ? 卢克显示它,因此必须有办法解决这个问题。 我需要它删除更新文件。
我搜索了文档,但没有找到在GetField中使用的术语,或者是否已经有另一种方法。
In lucene, I can do the following
doc.GetField("mycustomfield").StringValue();This retrieves the value of a column in an index's document.
My question, for the same 'doc', is there a way to get the Doc. Id ? Luke displays it hence there must be a way to figure this out. I need it to delete documents on updates.
I scoured the docs but have not found the term to use in GetField or if there already is another method.
最满意答案
事实证明你必须这样做:
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 thisTurns out you have to do this:
var hits = searcher.Search(query); var result = hits.Id(0);As opposed to
var results = hits.Doc(i); var docid = results.<...> //there's nothing I could find there to do this更多推荐
发布评论