我对Lucene的术语向量相当陌生,我想确保我的术语收集尽可能有效。
我得到了唯一的术语,然后检索术语的docFreq()来执行刻面。在
我用以下方法从索引中收集所有文档术语:
lindex = SimpleFSDirectory(File(indexdir))
ireader = IndexReader.open(lindex, True)
terms = ireader.terms() #Returns TermEnum
这很好用,但是有没有一种方法只返回特定字段(跨所有文档)的条件-这样会更有效吗?在
例如:
^{pr2}$
Tags:
在IndexReader.terms()接受可选的Field()对象。 Field对象由两个参数组成:字段名和lucene称之为“Term Field”和“Term Text”的值。在
通过为“term text”提供一个空值的字段参数,我们可以从我们关心的术语开始术语迭代。在
希望其他寻找如何在PyLucene中执行刻面的人会看到这篇文章。关键是按原样索引术语。为了完整起见,这就是字段值的索引方式。在
^{pr2}$相关问题 更多 >
编程相关推荐