如果编解码器未存储此度量值,则使用java
我在Lucene中看到了许多方法,其中包含以下文本:
if this measure isn't stored by the codec.
例如org的size()方法。阿帕奇。卢森。指数术语类别:
public abstract long size() throws IOException
Returns the number of terms for this field, or -1 if this measure isn't stored by the codec. Note that, just like other term measures, this measure does not take deleted documents into account.
这意味着什么
谢谢
# 1 楼答案
Codec是coder-decoder的缩写,它是处理lucene如何索引文档以及在文档中维护哪些数据的实现
像
Terms
(及其底层TermsEnum
)这样的类是抽象的,由编解码器本身实现。他们提供的很多内容都是有用的,但却是补充性的元数据。一些编解码器实现可能不会存储很多数据。在这种情况下,规范将返回-1作为一个标志,通常表示您请求的数据段不可用在其他情况下,如
Terms.getSumTotalTermFreq
,如果您将其配置为不存储您请求的数据,它可以返回-1