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

查看:15
本文介绍了一个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天全站免登陆