Lucene Field.Store.YES 与 Field.Store.NO [英] Lucene Field.Store.YES versus Field.Store.NO

查看:11
本文介绍了Lucene Field.Store.YES 与 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 字段,该字段可用于从 SQL 数据库、文件系统或一个网络资源.

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屋!

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