在SOLR中,为什么字段不被存储并且不被索引? [英] In SOLR why would a field be non-stored and non-indexed?

查看:57
本文介绍了在SOLR中,为什么字段不被存储并且不被索引?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Solr的有关原子更新的文档中,他们提到字段应该没有索引并且也没有存储.

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

仅当要更新的字段满足以下三个条件时,才使用此方法执行原子更新操作:

p是非索引(indexed ="false"),非存储(stored ="false"),单值(multiValued ="false")数字docValue(docValues ="true")字段.

<字段名称=价格"type ="float"indexed ="false";存储=假"docValues ="true"/>

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

这不是说它不可查询并且不会在响应中返回吗?

解决方案

在这种情况下要理解的是,设置"docValues = true" 可以替代"index= true" :仍使字段可查询",但在面向列(非反向)的索引中.

[...]一种内部记录字段值的方法对于某些目的(例如排序和分面)而言,效率高传统索引.

实际上,能够在sort/facet专用字段中进行原子更新是一个示例用例!

请记住,即使设置为"stored = false" ,仍可以获取启用了docValues的字段,例如,允许使用 fl 参数检索值.那是因为 docValues 以某种方式始终"存储,如何取决于 docValuesFormat ,默认为内存"(表示doc值存储在堆中).

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

In Solr's documentation around atomic updates, they mention that a field should be non-indexed and non-stored.

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

An atomic update operation is performed using this approach only when the fields to be updated meet these three conditions:

are non-indexed (indexed="false"), non-stored (stored="false"), single valued (multiValued="false") numeric docValues (docValues="true") fields;

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

What would be an example use-case of doing this?

Wouldn't that mean that it's not queryable and not returned in responses?

解决方案

The thing to understand in this context is that setting "docValues=true" is intended as an alternative to "index=true": still making the field "queryable" but in a column oriented (non-inverted) index.

[...] a way of recording field values internally that is more efficient for some purposes, such as sorting and faceting, than traditional indexing.

Actually being able to make atomic updates in a sort/facet-dedicated-field is an example use-case !

Remember that a field with docValues enabled can still be fetched even if set as "stored=false", allowing for example to retrieve values using the fl parameter. That is because docValues are in a way "always" stored, how depends on docValuesFormat that defaults to "Memory" (meaning doc values are stored in heap).

DocValues fields also relies on useDocValuesAsStored that defaults to true, meaning the field behaves as if it were defined as stored="true" even if defined as stored="false".

这篇关于在SOLR中,为什么字段不被存储并且不被索引?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆