lucene字段的store属性 [英] the store attribute of a lucene field

查看:131
本文介绍了lucene字段的store属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一个lucene的构造函数Field:

There is a constructor of lucene Field:

Field(String name, String value, Store store, Index index)

例如,我可以通过以下方式创建一个新字段:

For example I can create a new field by:

Field f1 = new Field("text", "The text content", Field.Store.YES, Field.Index.ANALYZED);

我不确定第四个参数的含义: Index

I am not exactly sure of the meaning of the fourth parameter: Index

如果我将其设置为 Index.No ,那么是否需要添加此项字段作为字段?

If I set it to Index.No,so is it needed to add this field as a "field"?

因为在我看来,一旦属性被声明为字段,它应该被索引,如果不是,那么为什么要将它声明为一个字段?

Since in my opinion,once a attribute is declared as a field, it should be Indexed,if not then why do you declare it as a field?

查询和搜索有什么区别?

What is the difference between query and search?

推荐答案

存储的字段是让Lucene回复给你一份文件。它们保持一个字段的原始值,没有分析。您可以使用它们向用户显示文档(不一定是所有字段)。

Stored fields are what is returned when you ask Lucene to give you back a document. They hold the original value of a field, with no analysis. You can use them to present the document to the users (not necessarily all fields).

未编入索引的存储字段对于存储有关文档的元数据非常有用。用户不会用来查询索引。一个示例可能是文档来自的数据库ID。用户永远不会使用此ID,因为他们不知道它,因此索引它通常是无用的。但是如果你存储它,那么你可以使用它来在运行时从你的数据库中收集额外的信息。

Stored fields that are not indexed are useful to store meta-data about a document that the user won't use to query the index. An example might be a database id where a document comes from. This id will never be used by the user since they does not know about it, so it is generally useless to index it. But if you store it, so you can use it to gather extra information from your db at runtime.

查询和搜索之间的区别是相当主观的。对于我自己来说,搜索实际上是在索引中搜索的一般行为,而查询是用于搜索的实际查询字符串指数

The difference between a query and a search is rather subjective. For myself, a search is really the general act of searching in the index while a query is the actual query string used to search the index.

这篇关于lucene字段的store属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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