在Lucene文档中,Field.Store和Field.Index都设置为“否"吗? [英] Field.Store and Field.Index both set to `NO` in a Lucene document?

查看:56
本文介绍了在Lucene文档中,Field.Store和Field.Index都设置为“否"吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道 Field.store Field.Index 在Lucene文档中的含义,并且知道 Field.store 的用例.code>或 Field.Index 设置为.

但是最近,当两者都设置为 NO 时,我遇到了一段代码.当我们需要将用例设置为 NO 吗?

PS:我提到了这个 SO问题,这解释了为什么一个设置为 NO 而另一个设置为 Yes,具有良好的用例,但它没有回答我的问题.

解决方案

Lucene是通用的全文本索引和搜索库,它本身不是诸如ElasticSearch或Solr之类的框架.

因此,如果您正在开发搜索应用程序并直接使用Lucene,则可以完全控制要在Lucene反向索引中索引哪些字段和/或从应用程序存储哪些字段.

在Lucene之上构建的诸如ElasticSearch或Solr之类的框架可能会使用架构进行索引编制,或者也可能是无架构的.

我认为,在无模式的情况下,明确忽略我们不想索引的字段并存储它们都是有意义的.

I am aware of what Field.store and Field.Index means in Lucene document and aware of the use-cases when either Field.store or Field.Index is set to NO.

But recently, I came across piece of code, when both are set to NO. Could anybody explain the use-case with an example, when we need to set them to NO ?.

PS: I referred to this SO question, which explains why one is set to NO and another is set to Yes, with good use-cases, but it doesn't give answer to my question.

解决方案

Lucene is the generic full-text indexing and search library and its not the framework in itself like ElasticSearch or Solr.

So, if you are developing your search application and directly using Lucene then you have full control over which fields to index and/or which fields to store from your app in the Lucene inverted index.

Frameworks like ElasticSearch or Solr which are built on top of Lucene, may use a schema for indexing or it might be schemaless too.

I think in cases where it's schemaless, it makes sense to explicitly ignore the fields which we don't want to index and store both.

这篇关于在Lucene文档中,Field.Store和Field.Index都设置为“否"吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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