【问题标题】:In SOLR why would a field be non-stored and non-indexed?在 SOLR 中,为什么一个字段是非存储和非索引的?
【发布时间】:2019-10-10 03:06:52
【问题描述】:

在 Solr 关于原子更新的文档中,他们提到字段应该是非索引和非存储的。

https://lucene.apache.org/solr/guide/7_6/updating-parts-of-documents.html#in-place-update-example

只有当需要更新的字段满足这三个条件时,才会使用这种方式进行原子更新操作:

是非索引 (indexed="false")、非存储 (stored="false")、单值 (multiValued="false") 数字 docValues (docValues="true") 字段;

<field name="price" type="float" indexed="false" stored="false" docValues="true"/>

这样做的示例用例是什么?

这是否意味着它不可查询且不会在响应中返回?

【问题讨论】:

标签: solr lucene


【解决方案1】:

在这种情况下要理解的是,设置"docValues=true" 旨在替代"index=true":仍然使字段“可查询”,但在面向列(非倒排)索引中。

[...] 一种在内部记录字段值的方法 对某些目的(例如排序和分面)有效,比 传统索引。

实际上能够在 sort/facet-dedicated-field 中进行原子更新一个示例用例!

请记住,即使设置为 "stored=false",启用 docValues 的字段仍然可以被获取,例如允许使用 fl 参数检索值。这是因为 docValues 以某种方式“始终”存储,如何依赖于默认为“Memory”的docValuesFormat(意味着 doc 值 存储 在堆中)。

DocValues 字段还依赖于默认为 true 的 useDocValuesAsStored,这意味着该字段的行为就像定义为 stored="true" 一样,即使定义为 stored="false"

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-08-14
    • 1970-01-01
    • 2011-04-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多