问题描述
我已经阅读了 lucene 4.0 的文档,现在这个库存储了一些统计数据,以便计算不同的评分模型,其中之一是 bm25.除了获取文档之外,还有其他方法可以获取其长度吗?
as I've read the documentation of the lucene 4.0, now this library stores some statistics as in order to compute different scoring models, one of them bm25. Is there a way, besides fetching a document, to fetch its length too?
推荐答案
你可以将任何你想要从 FieldInvertState 存储到规范"中,它也不必是 8 位浮点数.
You can store whatever you want from FieldInvertState into the 'norm', and it doesn't have to be a 8 bit float either.
默认是长度的有损存储,如果您想要实际的确切长度,也许您选择为每个文档使用较短的(16 位)或其他东西.
The default is a lossy storage of the length, if you want the actual exact length, maybe you choose to use a short (16bits) per document or something else instead.
参见 Similarity.computeNorm
See Similarity.computeNorm
这篇关于lucene 4.0 中的文档长度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!