Lucene Field.Store.YES与Field.Store.NO [英] Lucene Field.Store.YES versus Field.Store.NO
问题描述
请问有人在什么情况下可以使用Field.Store.NO
代替Field.Store.YES
吗?我对Lucene非常陌生.我正在尝试创建一个文档.根据我的基本知识,我正在做
Will someone please explain under what circumstance I may use Field.Store.NO
instead of Field.Store.YES
? I am extremely new to Lucene. And I am trying to create a document. Per my basic knowledge, I am doing
doc.add(new StringField(fieldNameA,fieldValueA,Field.Store.YES));
doc.add(new TextField(fieldNameB,fieldValueB,Field.Store.YES));
推荐答案
可以使用两种基本方法将文档写入Lucene.
There are two basic ways a document can be written into Lucene.
- 已建立索引-已对该字段进行分析和建立索引,并且可以对其进行搜索.
- 已存储-该字段的全文已存储,并将与搜索结果一起返回.
如果文档已建立索引但未存储,则可以搜索它,但不会与搜索结果一起返回.
If a document is indexed but not stored, you can search for it, but it won't be returned with search results.
一种合理的通用模式是使用lucene进行搜索,但仅存储一个ID字段,该ID字段可用于从例如SQL数据库,文件系统或SQL Server数据库中检索文档/记录的全部内容.网络资源.
One reasonably common pattern is to use lucene for search, but only have an ID field being stored which can be used to retrieve the full contents of the document/record from, for instance, a SQL database, a file system, or an web resource.
当该字段只是搜索工具时,您可能还选择不存储该字段,但不会向用户显示该字段,例如soundex/metaphone或内容字段的替代分析.
You might also opt not to store a field when that field is just a search tool, but you wouldn't display it to the user, such as a soundex/metaphone, or an alternate analysis of a content field.
这篇关于Lucene Field.Store.YES与Field.Store.NO的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!